Migrate window class registration and window creation to Unicode APIs

This commit is contained in:
GabsPuNs
2026-04-07 21:21:58 -04:00
parent 792248c5d5
commit 04040c117f
4 changed files with 14 additions and 75 deletions

View File

@@ -17,13 +17,11 @@ private:
//bool m_bHasAudio;
ArchiveFile *m_archiveFile;
public:
using AbstractTexturePack::getResource;
DLCTexturePack(DWORD id, DLCPack *pack, TexturePack *fallback);
~DLCTexturePack();
// ~DLCTexturePack();
virtual wstring getResource(const wstring& name);
virtual DLCPack * getDLCPack();
@@ -36,6 +34,7 @@ public:
IXACT3WaveBank *m_pStreamedWaveBank;
IXACT3SoundBank *m_pSoundBank;
#endif
protected:
//@Override
void loadIcon();

View File

@@ -11,76 +11,19 @@ FileTexturePack::FileTexturePack(DWORD id, File *file, TexturePack *fallback) :
void FileTexturePack::unload(Textures *textures)
{
#if 0
super.unload(textures);
try {
if (zipFile != null) zipFile.close();
}
catch (IOException ignored)
{
}
zipFile = null;
#endif
}
InputStream *FileTexturePack::getResourceImplementation(const wstring &name) //throws IOException
{
#if 0
loadZipFile();
ZipEntry entry = zipFile.getEntry(name.substring(1));
if (entry == null) {
throw new FileNotFoundException(name);
}
return zipFile.getInputStream(entry);
#endif
return nullptr;
}
bool FileTexturePack::hasFile(const wstring &name)
{
#if 0
try {
loadZipFile();
return zipFile.getEntry(name.substring(1)) != null;
} catch (Exception e) {
return false;
}
#endif
return false;
}
void FileTexturePack::loadZipFile() //throws IOException
{
#if 0
if (zipFile != null) {
return;
}
zipFile = new ZipFile(file);
#endif
}
bool FileTexturePack::isTerrainUpdateCompatible()
{
#if 0
try {
loadZipFile();
Enumeration<? extends ZipEntry> entries = zipFile.entries();
while (entries.hasMoreElements()) {
ZipEntry entry = entries.nextElement();
if (entry.getName().startsWith("textures/")) {
return true;
}
}
} catch (Exception ignored) {
}
boolean hasOldFiles = hasFile("terrain.png") || hasFile("gui/items.png");
return !hasOldFiles;
#endif
return false;
}

View File

@@ -24,9 +24,6 @@ public:
//@Override
bool hasFile(const wstring &name);
private:
void loadZipFile(); //throws IOException
public:
bool isTerrainUpdateCompatible();
};

View File

@@ -515,7 +515,7 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
break;
default:
return DefWindowProc(hWnd, message, wParam, lParam);
return DefWindowProcW(hWnd, message, wParam, lParam);
}
break;
case WM_PAINT:
@@ -572,7 +572,7 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
else if (vk == VK_MENU)
vk = (lParam & (1 << 24)) ? VK_RMENU : VK_LMENU;
g_KBMInput.OnKeyDown(vk);
return DefWindowProc(hWnd, message, wParam, lParam);
return DefWindowProcW(hWnd, message, wParam, lParam);
}
case WM_KEYUP:
case WM_SYSKEYUP:
@@ -670,7 +670,7 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
}
break;
default:
return DefWindowProc(hWnd, message, wParam, lParam);
return DefWindowProcW(hWnd, message, wParam, lParam);
}
return 0;
}
@@ -682,23 +682,23 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
//
ATOM MyRegisterClass(HINSTANCE hInstance)
{
WNDCLASSEX wcex;
WNDCLASSEXW wcex;
wcex.cbSize = sizeof(WNDCLASSEX);
wcex.cbSize = sizeof(WNDCLASSEXW);
wcex.style = CS_HREDRAW | CS_VREDRAW;
wcex.lpfnWndProc = WndProc;
wcex.cbClsExtra = 0;
wcex.cbWndExtra = 0;
wcex.hInstance = hInstance;
wcex.hIcon = LoadIcon(hInstance, "Minecraft");
wcex.hIcon = LoadIconW(hInstance, L"Minecraft");
wcex.hCursor = LoadCursor(nullptr, IDC_ARROW);
wcex.hbrBackground = (HBRUSH)(COLOR_WINDOW+1);
wcex.lpszMenuName = "Minecraft";
wcex.lpszClassName = "MinecraftClass";
wcex.hIconSm = LoadIcon(wcex.hInstance, MAKEINTRESOURCE(IDI_MINECRAFTWINDOWS));
wcex.lpszMenuName = L"Minecraft";
wcex.lpszClassName = L"MinecraftClass";
wcex.hIconSm = LoadIconW(wcex.hInstance, MAKEINTRESOURCE(IDI_MINECRAFTWINDOWS));
return RegisterClassEx(&wcex);
return RegisterClassExW(&wcex);
}
//
@@ -718,8 +718,8 @@ BOOL InitInstance(HINSTANCE hInstance, int nCmdShow)
RECT wr = {0, 0, g_rScreenWidth, g_rScreenHeight}; // set the size, but not the position
AdjustWindowRect(&wr, WS_OVERLAPPEDWINDOW, FALSE); // adjust the size
g_hWnd = CreateWindow( "MinecraftClass",
"Minecraft",
g_hWnd = CreateWindowW( L"MinecraftClass",
L"Minecraft",
WS_OVERLAPPEDWINDOW,
CW_USEDEFAULT,
0,