Several fixes for windows

improve on the fex type check, so it works on windows x86/64
move BindAppIcon from BindControls in guiinit.cpp to wxvbam to avoid a timing issue that see's the icon not populated on windows till late.
adds 3 more icon sizes to the icon on windows.
This commit is contained in:
Squall-Leonhart 2025-07-16 07:56:24 +10:00
parent bbaf70c083
commit ae8bfb4ab3
6 changed files with 14 additions and 8 deletions

View File

@ -56,7 +56,7 @@ int fex_has_extension(const char str[], const char extension[]);
Returns usual file extension this should have (e.g. ".zip", ".gz", etc.). Returns usual file extension this should have (e.g. ".zip", ".gz", etc.).
Returns "" if file header is not recognized. */ Returns "" if file header is not recognized. */
const char *fex_identify_header(const void *header); const char *fex_identify_header(const void *header);
enum { fex_identify_header_size = 16 }; enum { fex_identify_header_size = 263 };
/** Determines type based on extension of a file path, or just a lone extension /** Determines type based on extension of a file path, or just a lone extension
(must include '.', e.g. ".zip", NOT just "zip"). Returns NULL if extension is (must include '.', e.g. ".zip", NOT just "zip"). Returns NULL if extension is

View File

@ -68,13 +68,19 @@ BLARGG_EXPORT fex_err_t fex_init( void )
return blargg_ok; return blargg_ok;
} }
BLARGG_EXPORT const char* fex_identify_header( void const* header ) BLARGG_EXPORT const char* fex_identify_header(const void* header)
{ {
unsigned char *data = (unsigned char *)header; const unsigned char* data = static_cast<const unsigned char*>(header);
if ((data[0] == 0xFD) || (data[1] == 0x37) || (data[2] == 0x7A) || (data[3] == 0x58) || (data[4] == 0x5A) || (data[5] == 0x00)) // Safely detect .xz (magic bytes at offset 0)
if (memcmp(data, "\xFD\x37\x7A\x58\x5A\x00", 6) == 0)
return ".xz"; return ".xz";
// Safely detect .tar (magic string at offset 257)
const char tar_magic[] = "ustar";
if (memcmp(data + 257, tar_magic, sizeof(tar_magic)) == 0 && data[262] == 0x00)
return ".tar";
unsigned four = get_be32( header ); unsigned four = get_be32( header );
switch ( four ) switch ( four )
{ {

View File

@ -1681,8 +1681,6 @@ bool MainFrame::BindControls()
// the idle loop on wxGTK // the idle loop on wxGTK
wxIdleEvent::SetMode(wxIDLE_PROCESS_SPECIFIED); wxIdleEvent::SetMode(wxIDLE_PROCESS_SPECIFIED);
BindAppIcon();
// NOOP if no status area // NOOP if no status area
SetStatusText(wxT("")); SetStatusText(wxT(""));

Binary file not shown.

Before

Width:  |  Height:  |  Size: 68 KiB

After

Width:  |  Height:  |  Size: 180 KiB

View File

@ -614,6 +614,8 @@ bool wxvbamApp::OnInit() {
frame->Show(true); frame->Show(true);
frame->BindAppIcon();
#ifndef NO_ONLINEUPDATES #ifndef NO_ONLINEUPDATES
initAutoupdater(); initAutoupdater();
#endif #endif

View File

@ -310,7 +310,7 @@ public:
// required for event handling // required for event handling
DECLARE_EVENT_TABLE(); DECLARE_EVENT_TABLE();
protected: public:
virtual void BindAppIcon(); virtual void BindAppIcon();
private: private: