diff --git a/src/core/fex/fex.h b/src/core/fex/fex.h index 1f6d5418..0835b811 100644 --- a/src/core/fex/fex.h +++ b/src/core/fex/fex.h @@ -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 "" if file header is not recognized. */ 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 (must include '.', e.g. ".zip", NOT just "zip"). Returns NULL if extension is diff --git a/src/core/fex/fex/fex.cpp b/src/core/fex/fex/fex.cpp index 3b4dde12..69bf79be 100644 --- a/src/core/fex/fex/fex.cpp +++ b/src/core/fex/fex/fex.cpp @@ -68,12 +68,18 @@ BLARGG_EXPORT fex_err_t fex_init( void ) 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(header); - if ((data[0] == 0xFD) || (data[1] == 0x37) || (data[2] == 0x7A) || (data[3] == 0x58) || (data[4] == 0x5A) || (data[5] == 0x00)) - return ".xz"; + // Safely detect .xz (magic bytes at offset 0) + if (memcmp(data, "\xFD\x37\x7A\x58\x5A\x00", 6) == 0) + 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 ); switch ( four ) diff --git a/src/wx/guiinit.cpp b/src/wx/guiinit.cpp index 3744e223..0d40b008 100644 --- a/src/wx/guiinit.cpp +++ b/src/wx/guiinit.cpp @@ -1681,8 +1681,6 @@ bool MainFrame::BindControls() // the idle loop on wxGTK wxIdleEvent::SetMode(wxIDLE_PROCESS_SPECIFIED); - BindAppIcon(); - // NOOP if no status area SetStatusText(wxT("")); diff --git a/src/wx/icons/visualboyadvance-m.ico b/src/wx/icons/visualboyadvance-m.ico index 01a28625..f638edad 100644 Binary files a/src/wx/icons/visualboyadvance-m.ico and b/src/wx/icons/visualboyadvance-m.ico differ diff --git a/src/wx/wxvbam.cpp b/src/wx/wxvbam.cpp index ef74dbfc..5bcfd977 100644 --- a/src/wx/wxvbam.cpp +++ b/src/wx/wxvbam.cpp @@ -614,6 +614,8 @@ bool wxvbamApp::OnInit() { frame->Show(true); + frame->BindAppIcon(); + #ifndef NO_ONLINEUPDATES initAutoupdater(); #endif diff --git a/src/wx/wxvbam.h b/src/wx/wxvbam.h index 999219d0..e2e1c559 100644 --- a/src/wx/wxvbam.h +++ b/src/wx/wxvbam.h @@ -310,7 +310,7 @@ public: // required for event handling DECLARE_EVENT_TABLE(); -protected: +public: virtual void BindAppIcon(); private: