From 04040c117f418a1133ed49f1d596e4545bc6644b Mon Sep 17 00:00:00 2001 From: GabsPuNs Date: Tue, 7 Apr 2026 21:21:58 -0400 Subject: [PATCH] Migrate window class registration and window creation to Unicode APIs --- Minecraft.Client/DLCTexturePack.h | 5 +- Minecraft.Client/FileTexturePack.cpp | 57 ------------------- Minecraft.Client/FileTexturePack.h | 3 - .../Windows64/Windows64_Minecraft.cpp | 24 ++++---- 4 files changed, 14 insertions(+), 75 deletions(-) diff --git a/Minecraft.Client/DLCTexturePack.h b/Minecraft.Client/DLCTexturePack.h index 595c47da..227617e6 100644 --- a/Minecraft.Client/DLCTexturePack.h +++ b/Minecraft.Client/DLCTexturePack.h @@ -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(); diff --git a/Minecraft.Client/FileTexturePack.cpp b/Minecraft.Client/FileTexturePack.cpp index 711f6736..fb2588fd 100644 --- a/Minecraft.Client/FileTexturePack.cpp +++ b/Minecraft.Client/FileTexturePack.cpp @@ -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 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; } \ No newline at end of file diff --git a/Minecraft.Client/FileTexturePack.h b/Minecraft.Client/FileTexturePack.h index 85221d11..23ae9fa4 100644 --- a/Minecraft.Client/FileTexturePack.h +++ b/Minecraft.Client/FileTexturePack.h @@ -24,9 +24,6 @@ public: //@Override bool hasFile(const wstring &name); -private: - void loadZipFile(); //throws IOException - public: bool isTerrainUpdateCompatible(); }; diff --git a/Minecraft.Client/Windows64/Windows64_Minecraft.cpp b/Minecraft.Client/Windows64/Windows64_Minecraft.cpp index 2e7dae90..a38f5824 100644 --- a/Minecraft.Client/Windows64/Windows64_Minecraft.cpp +++ b/Minecraft.Client/Windows64/Windows64_Minecraft.cpp @@ -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,