mirror of
https://github.com/hrydgard/ppsspp.git
synced 2025-02-12 09:38:20 +00:00
Core: Cleanup MAC address handling.
No need to make it leak, even if it doesn't matter much on shutdown. Better to have the leak listing empty.
This commit is contained in:
parent
90f3ae14e0
commit
9ea7281b3c
@ -292,7 +292,7 @@ const char *DefaultLangRegion() {
|
||||
return defaultLangRegion.c_str();
|
||||
}
|
||||
|
||||
const char *CreateRandMAC() {
|
||||
std::string CreateRandMAC() {
|
||||
std::stringstream randStream;
|
||||
srand(time(nullptr));
|
||||
for (int i = 0; i < 6; i++) {
|
||||
@ -305,8 +305,7 @@ const char *CreateRandMAC() {
|
||||
randStream << ':'; //we need a : between every octet
|
||||
}
|
||||
}
|
||||
// It's ok to strdup, this runs once and will be freed by exiting the process anyway
|
||||
return strdup(randStream.str().c_str());
|
||||
return randStream.str();
|
||||
}
|
||||
|
||||
static int DefaultNumWorkers() {
|
||||
@ -737,7 +736,7 @@ static ConfigSetting systemParamSettings[] = {
|
||||
ReportedConfigSetting("PSPFirmwareVersion", &g_Config.iFirmwareVersion, PSP_DEFAULT_FIRMWARE, true, true),
|
||||
ConfigSetting("NickName", &g_Config.sNickName, "PPSSPP", true, true),
|
||||
ConfigSetting("proAdhocServer", &g_Config.proAdhocServer, "coldbird.net", true, true),
|
||||
ConfigSetting("MacAddress", &g_Config.sMACAddress, &CreateRandMAC, true, true),
|
||||
ConfigSetting("MacAddress", &g_Config.sMACAddress, "", true, true),
|
||||
ConfigSetting("PortOffset", &g_Config.iPortOffset, 0, true, true),
|
||||
ReportedConfigSetting("Language", &g_Config.iLanguage, &DefaultSystemParamLanguage, true, true),
|
||||
ConfigSetting("TimeFormat", &g_Config.iTimeFormat, PSP_SYSTEMPARAM_TIME_FORMAT_24HR, true, true),
|
||||
@ -1033,7 +1032,7 @@ void Config::Load(const char *iniFileName, const char *controllerIniFilename) {
|
||||
|
||||
CleanRecent();
|
||||
|
||||
// Fix Wrong MAC address by old version by "Change MAC address"
|
||||
// Set a default MAC, and correct if it's an old format.
|
||||
if (sMACAddress.length() != 17)
|
||||
sMACAddress = CreateRandMAC();
|
||||
|
||||
|
@ -515,7 +515,7 @@ private:
|
||||
};
|
||||
|
||||
std::map<std::string, std::pair<std::string, int>> GetLangValuesMapping();
|
||||
const char *CreateRandMAC();
|
||||
std::string CreateRandMAC();
|
||||
|
||||
// TODO: Find a better place for this.
|
||||
extern http::Downloader g_DownloadManager;
|
||||
|
@ -1128,7 +1128,7 @@ UI::EventReturn GameSettingsScreen::OnChangeproAdhocServerAddress(UI::EventParam
|
||||
}
|
||||
|
||||
UI::EventReturn GameSettingsScreen::OnChangeMacAddress(UI::EventParams &e) {
|
||||
g_Config.sMACAddress = std::string(CreateRandMAC());
|
||||
g_Config.sMACAddress = CreateRandMAC();
|
||||
|
||||
return UI::EVENT_DONE;
|
||||
}
|
||||
|
@ -133,6 +133,7 @@ bool AndroidEGLGraphicsContext::Init(ANativeWindow *wnd, int backbufferWidth, in
|
||||
void AndroidEGLGraphicsContext::Shutdown() {
|
||||
delete draw_;
|
||||
draw_ = nullptr;
|
||||
NativeShutdownGraphics();
|
||||
gl->ClearCurrent();
|
||||
gl->Shutdown();
|
||||
delete gl;
|
||||
@ -293,12 +294,14 @@ bool AndroidVulkanContext::Init(ANativeWindow *wnd, int desiredBackbufferSizeX,
|
||||
}
|
||||
|
||||
void AndroidVulkanContext::Shutdown() {
|
||||
delete draw_;
|
||||
draw_ = nullptr;
|
||||
NativeShutdownGraphics();
|
||||
|
||||
g_Vulkan->WaitUntilQueueIdle();
|
||||
g_Vulkan->DestroyObjects();
|
||||
g_Vulkan->DestroyDebugMsgCallback();
|
||||
g_Vulkan->DestroyDevice();
|
||||
delete draw_;
|
||||
draw_ = nullptr;
|
||||
|
||||
delete g_Vulkan;
|
||||
g_Vulkan = nullptr;
|
||||
@ -611,7 +614,6 @@ extern "C" void Java_org_ppsspp_ppsspp_NativeApp_pause(JNIEnv *, jclass) {
|
||||
extern "C" void Java_org_ppsspp_ppsspp_NativeApp_shutdown(JNIEnv *, jclass) {
|
||||
ILOG("NativeApp.shutdown() -- begin");
|
||||
if (renderer_inited) {
|
||||
NativeShutdownGraphics();
|
||||
graphicsContext->Shutdown();
|
||||
delete graphicsContext;
|
||||
graphicsContext = nullptr;
|
||||
@ -1042,7 +1044,6 @@ extern "C" bool JNICALL Java_org_ppsspp_ppsspp_NativeActivity_runEGLRenderLoop(J
|
||||
g_gameInfoCache->WorkQueue()->Flush();
|
||||
|
||||
NativeDeviceLost();
|
||||
NativeShutdownGraphics();
|
||||
renderer_inited = false;
|
||||
|
||||
graphicsContext->Shutdown();
|
||||
|
Loading…
x
Reference in New Issue
Block a user