Fix config app (#89)

This commit is contained in:
Anders Jenbo 2025-05-15 02:52:37 +02:00 committed by GitHub
parent 7fa7643bfb
commit c6107bdb5b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 14 additions and 17 deletions

View File

@ -130,8 +130,8 @@ struct CMenu {
struct CWinApp {
CWinApp();
virtual ~CWinApp();
virtual BOOL InitInstance();
virtual ~CWinApp() = default;
virtual BOOL InitInstance() = 0;
virtual int ExitInstance();
};
@ -188,10 +188,7 @@ inline int GetSystemMetrics(int nIndex)
return 0;
}
inline BOOL GetVersionEx(OSVERSIONINFOA* version)
{
return TRUE;
}
BOOL GetVersionEx(OSVERSIONINFOA* version);
void GlobalMemoryStatus(MEMORYSTATUS* memory_status);

View File

@ -21,20 +21,13 @@ CWinApp::CWinApp()
abort();
}
wndTop = this;
}
CWinApp::~CWinApp() = default;
BOOL CWinApp::InitInstance()
{
if (!SDL_Init(SDL_INIT_VIDEO | SDL_INIT_AUDIO | SDL_INIT_JOYSTICK)) {
SDL_Log("SDL_Init: %s\n", SDL_GetError());
return FALSE;
return;
}
window = SDL_CreateWindow(title, 640, 480, 0);
return TRUE;
}
int CWinApp::ExitInstance()
@ -73,9 +66,7 @@ int main(int argc, char* argv[])
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "No CWinApp created");
abort();
}
if (!wndTop->InitInstance()) {
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "CWinApp::InitInstance failed");
}
wndTop->InitInstance();
SDL_Event event;
bool running = true;
@ -137,6 +128,15 @@ BOOL GetWindowRect(HWND hWnd, RECT* Rect)
return TRUE;
}
BOOL GetVersionEx(OSVERSIONINFOA* version)
{
version->dwOSVersionInfoSize = sizeof(OSVERSIONINFOA);
version->dwMajorVersion = 5; // Win2k/XP
version->dwPlatformId = 2; // NT
version->dwBuildNumber = 0x500;
return TRUE;
}
void OutputDebugString(const char* lpOutputString)
{
SDL_LogDebug(SDL_LOG_CATEGORY_APPLICATION, "%s", lpOutputString);