From ce03bf18e71de5fd8b909045af57d9d58db371ea Mon Sep 17 00:00:00 2001 From: Matthew Budd Date: Mon, 15 Jun 2020 21:48:32 -0400 Subject: [PATCH 01/13] Resolved cppcheck warnings in OutputDS.cpp --- src/drivers/win/OutputDS.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/drivers/win/OutputDS.cpp b/src/drivers/win/OutputDS.cpp index 7414a918..ffe58d9b 100644 --- a/src/drivers/win/OutputDS.cpp +++ b/src/drivers/win/OutputDS.cpp @@ -145,12 +145,14 @@ public: class ThreadData { public: - ThreadData() { kill = dead = false; } + ThreadData() { ds = NULL; kill = dead = false; } OAKRA_Module_OutputDS *ds; bool kill,dead; }; -OAKRA_Module_OutputDS::OAKRA_Module_OutputDS() { +OAKRA_Module_OutputDS::OAKRA_Module_OutputDS() +{ + threadData = NULL; data = new Data(); ((Data *)data)->global = false; InitializeCriticalSection(&((Data *)data)->criticalSection); @@ -179,6 +181,7 @@ OAKRA_Voice *OAKRA_Module_OutputDS::getVoice(OAKRA_Format &format, OAKRA_Module if(dsv->dead) { delete dsv; + dsv = 0; } else { @@ -214,7 +217,7 @@ void OAKRA_Module_OutputDS::freeVoiceInternal(OAKRA_Voice *voice, bool internal) if(!internal) { delete voice; - voice = 0; + //voice = 0; // Assignment of function parameter has no effect outside the function, commenting out to avoid cppcheck warning } unlock(); } From 9eaad6e14dbb4ebb029a0709c493d8053679c745 Mon Sep 17 00:00:00 2001 From: Matthew Budd Date: Mon, 15 Jun 2020 21:58:13 -0400 Subject: [PATCH 02/13] Revolved Deallocating a deallocated pointer: buf warning in archive.cpp. --- src/drivers/win/archive.cpp | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/drivers/win/archive.cpp b/src/drivers/win/archive.cpp index 75bdfff7..7aa93f30 100644 --- a/src/drivers/win/archive.cpp +++ b/src/drivers/win/archive.cpp @@ -181,7 +181,7 @@ protected: public: explicit InStream() - : refCount(0) + : refCount(0), size(0) {} }; @@ -374,17 +374,21 @@ void initArchiveSystem() } } -static std::string wstringFromPROPVARIANT(BSTR bstr, bool& success) { +static std::string wstringFromPROPVARIANT(BSTR bstr, bool& success) +{ + std::string strret; std::wstring tempfname = bstr; int buflen = tempfname.size()*2; char* buf = new char[buflen]; int ret = WideCharToMultiByte(CP_ACP,0,tempfname.c_str(),tempfname.size(),buf,buflen,0,0); - if(ret == 0) { + if (ret == 0) + { delete[] buf; success = false; + return strret; } buf[ret] = 0; - std::string strret = buf; + strret = buf; delete[] buf; success = true; return strret; @@ -594,4 +598,4 @@ FCEUFILE* FCEUD_OpenArchive(ArchiveScanRecord& asr, std::string& fname, std::str FCEUFILE* FCEUD_OpenArchive(ArchiveScanRecord& asr, std::string& fname, std::string* innerFilename) { return FCEUD_OpenArchive(asr, fname, innerFilename, -1); -} \ No newline at end of file +} From 96cba27965c0e5d3f568ec9e2d7e5fade3e90fbd Mon Sep 17 00:00:00 2001 From: Matthew Budd Date: Mon, 15 Jun 2020 22:09:12 -0400 Subject: [PATCH 03/13] Resolved cppcheck warnings in cheats.cpp. --- src/drivers/win/cheat.cpp | 14 +++++++------- src/drivers/win/ramwatch.h | 8 +++++++- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/src/drivers/win/cheat.cpp b/src/drivers/win/cheat.cpp index 0fdc721d..51420385 100644 --- a/src/drivers/win/cheat.cpp +++ b/src/drivers/win/cheat.cpp @@ -538,7 +538,7 @@ INT_PTR CALLBACK CheatConsoleCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARA break; case CHEAT_CONTEXT_POSSI_ADDTOMEMORYWATCH: { - char addr[16] = { 0 }; + char addr[32] = { 0 }; int sel = SendDlgItemMessage(hwndDlg, IDC_CHEAT_LIST_POSSIBILITIES, LVM_GETSELECTIONMARK, 0, 0); if (sel != -1) { @@ -816,9 +816,9 @@ INT_PTR CALLBACK CheatConsoleCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARA if (strchr(buf, ':')) { if (strchr(buf, '?')) - sscanf(buf, "%X:%X?%X", &a, &c, &v); + sscanf(buf, "%X:%X?%X", (unsigned int*)&a, (unsigned int*)&c, (unsigned int*)&v); else - sscanf(buf, "%X:%X", &a, &v); + sscanf(buf, "%X:%X", (unsigned int*)&a, (unsigned int*)&v); } SetDlgItemText(hwndDlg, IDC_CHEAT_ADDR, (LPCSTR)(a == -1 ? "" : U16ToStr(a))); @@ -978,7 +978,7 @@ INT_PTR CALLBACK CheatConsoleCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARA break; case NM_DBLCLK: { - char addr[16]; + char addr[32]; sprintf(addr, "%04X", possiList[((NMITEMACTIVATE*)lParam)->iItem].addr); AddMemWatch(addr); } @@ -1035,19 +1035,19 @@ void UpdateCheatListGroupBoxUI() char temp[64]; if (FrozenAddressCount < 256) { - sprintf(temp, "Active Cheats %d", FrozenAddressCount); + sprintf(temp, "Active Cheats %u", FrozenAddressCount); EnableWindow(GetDlgItem(hCheat, IDC_BTN_CHEAT_ADD), TRUE); EnableWindow(GetDlgItem(hCheat, IDC_BTN_CHEAT_ADDFROMFILE), TRUE); } else if (FrozenAddressCount == 256) { - sprintf(temp, "Active Cheats %d (Max Limit)", FrozenAddressCount); + sprintf(temp, "Active Cheats %u (Max Limit)", FrozenAddressCount); EnableWindow(GetDlgItem(hCheat, IDC_BTN_CHEAT_ADD), FALSE); EnableWindow(GetDlgItem(hCheat, IDC_BTN_CHEAT_ADDFROMFILE), FALSE); } else { - sprintf(temp, "%d Error: Too many cheats loaded!", FrozenAddressCount); + sprintf(temp, "%u Error: Too many cheats loaded!", FrozenAddressCount); EnableWindow(GetDlgItem(hCheat, IDC_BTN_CHEAT_ADD), FALSE); EnableWindow(GetDlgItem(hCheat, IDC_BTN_CHEAT_ADDFROMFILE), FALSE); } diff --git a/src/drivers/win/ramwatch.h b/src/drivers/win/ramwatch.h index fd625b9d..c1d765c6 100644 --- a/src/drivers/win/ramwatch.h +++ b/src/drivers/win/ramwatch.h @@ -52,11 +52,17 @@ struct AddressWatcher { unsigned int Address; // hardware address unsigned int CurValue; - char* comment = NULL; // NULL means no comment, non-NULL means allocated comment + char* comment; // NULL means no comment, non-NULL means allocated comment bool WrongEndian; char Size; //'d' = 4 bytes, 'w' = 2 bytes, 'b' = 1 byte, and 'S' means it's a separator. char Type;//'s' = signed integer, 'u' = unsigned, 'h' = hex, 'b' = binary, 'S' = separator short Cheats; // how many bytes are affected by cheat + + AddressWatcher(void) + { + Address = 0; CurValue = 0; comment = NULL; WrongEndian = false; + Size = 'b'; Type = 's'; Cheats = 0; + } }; // the struct for communicating with add watch window From e6329b911a5cfc9c56b28cae07fe276cbb35c9f6 Mon Sep 17 00:00:00 2001 From: Matthew Budd Date: Mon, 15 Jun 2020 22:21:54 -0400 Subject: [PATCH 04/13] Resolved cppcheck warnings in win/header_editor.cpp --- src/drivers/win/header_editor.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/drivers/win/header_editor.cpp b/src/drivers/win/header_editor.cpp index 6c55525a..797e4b52 100644 --- a/src/drivers/win/header_editor.cpp +++ b/src/drivers/win/header_editor.cpp @@ -1454,7 +1454,7 @@ int GetComboBoxByteSize(HWND hwnd, UINT id, int* value) if (!GetComboBoxListItemData(hwnd, id, value, buf, true)) { char buf2[4]; - if (sscanf(buf, "%d%[KMB]", value, buf2) < 2 || !strcmp(buf2, "")) + if (sscanf(buf, "%d%3[KMB]", value, buf2) < 2 || !strcmp(buf2, "")) err = errors::FORMAT_ERR; else { @@ -1524,15 +1524,15 @@ bool GetComboBoxListItemData(HWND hwnd, UINT id, int* value, char* buf, bool exa case IDC_VS_SYSTEM_COMBO: case IDC_VS_PPU_COMBO: case IDC_SYSTEM_EXTEND_COMBO: - if (!(success = sscanf(buf, "$%X", value) > 0)) + if (!(success = sscanf(buf, "$%X", (unsigned int *)value) > 0)) success = SearchByString(hwnd, id, value, buf); else SetDlgItemText(hwnd, id, buf); break; case IDC_INPUT_DEVICE_COMBO: - if (success = sscanf(buf, "$%X", value) > 0) + if (success = sscanf(buf, "$%X", (unsigned int *)value) > 0) { - char buf2[3]; + char buf2[8]; sprintf(buf2, "$%02X", *value); if (SendDlgItemMessage(hwnd, id, CB_SELECTSTRING, 0, (LPARAM)buf2) == CB_ERR) SetDlgItemText(hwnd, id, buf); @@ -1694,4 +1694,4 @@ bool SearchByString(HWND hwnd, UINT id, int* value, char* buf) } return false; -} \ No newline at end of file +} From ad69657d026965ddf8cd7d2b74c080bdecd632c3 Mon Sep 17 00:00:00 2001 From: Matthew Budd Date: Mon, 15 Jun 2020 22:53:45 -0400 Subject: [PATCH 05/13] Resolved a few more cppcheck/compiler warnings in core input module. --- src/file.h | 2 +- src/input.cpp | 13 ++++++++----- src/input.h | 2 +- 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/src/file.h b/src/file.h index 3afb9967..f5dcf426 100644 --- a/src/file.h +++ b/src/file.h @@ -42,7 +42,7 @@ struct FCEUFILE { FCEUFILE() : stream(0) - , archiveCount(-1) + , archiveCount(-1), archiveIndex(0), size(0), mode(READ) {} ~FCEUFILE() diff --git a/src/input.cpp b/src/input.cpp index f44c7ef6..7318b0f9 100644 --- a/src/input.cpp +++ b/src/input.cpp @@ -484,6 +484,7 @@ static void SetInputStuff(int port) joyports[port].driver=FCEU_InitVirtualBoy(port); break; case SI_NONE: + case SI_UNSET: joyports[port].driver=&DummyJPort; break; } @@ -494,6 +495,7 @@ static void SetInputStuffFC() switch(portFC.type) { case SIFC_NONE: + case SIFC_UNSET: portFC.driver=&DummyPortFC; break; case SIFC_ARKANOID: @@ -721,7 +723,7 @@ const char* FCEUI_CommandTypeNames[]= "TAS Editor", }; -static void CommandUnImpl(void); +//static void CommandUnImpl(void); static void CommandToggleDip(void); static void CommandStateLoad(void); static void CommandStateSave(void); @@ -938,10 +940,11 @@ void FCEUI_HandleEmuCommands(TestCommandState* testfn) } } -static void CommandUnImpl(void) -{ - FCEU_DispMessage("command '%s' unimplemented.",0, FCEUI_CommandTable[i].name); -} +// Function not currently used +//static void CommandUnImpl(void) +//{ +// FCEU_DispMessage("command '%s' unimplemented.",0, FCEUI_CommandTable[i].name); +//} static void CommandToggleDip(void) { diff --git a/src/input.h b/src/input.h index 14b72677..b3c4199a 100644 --- a/src/input.h +++ b/src/input.h @@ -74,7 +74,7 @@ struct INPUTCFC extern struct JOYPORT { JOYPORT(int _w) - : w(_w) + : w(_w), attrib(0), type(SI_UNSET), ptr(0), driver(0) {} int w; From d094891bb41921b8b8c28c1f4126dff55ed0760e Mon Sep 17 00:00:00 2001 From: Matthew Budd Date: Tue, 16 Jun 2020 09:12:55 -0400 Subject: [PATCH 06/13] Testing build artifact push --- pipelines/debpkg.pl | 2 +- pipelines/linux_build.sh | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/pipelines/debpkg.pl b/pipelines/debpkg.pl index 64c04735..e0960679 100755 --- a/pipelines/debpkg.pl +++ b/pipelines/debpkg.pl @@ -2,7 +2,7 @@ use strict; -my $VERSION="2.2.4"; +my $VERSION="2.2.3"; my $INSTALL_PREFIX="/tmp/fceux"; my $CTL_FILENAME="$INSTALL_PREFIX/DEBIAN/control"; my $ARCH="amd64"; diff --git a/pipelines/linux_build.sh b/pipelines/linux_build.sh index 5acd73b1..8a2f2024 100755 --- a/pipelines/linux_build.sh +++ b/pipelines/linux_build.sh @@ -112,3 +112,6 @@ echo '**************************************************************' echo 'Testing Install of Package' echo '**************************************************************' sudo dpkg -i /tmp/fceux-*.deb + +echo 'Pushing Debian Package to Build Artifacts' +appveyor PushArtifact /tmp/fceux-*.deb From 968c15f0f76761207610810c00df65d81201df04 Mon Sep 17 00:00:00 2001 From: Matthew Budd Date: Tue, 16 Jun 2020 09:38:15 -0400 Subject: [PATCH 07/13] Added windows packaging script call to appveyor config. --- appveyor.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/appveyor.yml b/appveyor.yml index ff7c0140..7690b758 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -5,4 +5,6 @@ image: #- Ubuntu1804 build_script: - cmd: msbuild "./vc/vc14_fceux.sln" +- cmd: ./vc/archive.bat +- cmd: appveyor PushArtifact ./vc/fceux.zip - sh: ./pipelines/linux_build.sh From fcf2135426bae005fa04cbcef037e75d317ee677 Mon Sep 17 00:00:00 2001 From: Matthew Budd Date: Tue, 16 Jun 2020 09:47:28 -0400 Subject: [PATCH 08/13] win32 build packaging pathing fixes. --- appveyor.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index 7690b758..a83085a7 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -5,6 +5,8 @@ image: #- Ubuntu1804 build_script: - cmd: msbuild "./vc/vc14_fceux.sln" -- cmd: ./vc/archive.bat -- cmd: appveyor PushArtifact ./vc/fceux.zip +- cmd: cd vc +- cmd: archive.bat +- cmd: cd .. +- cmd: appveyor PushArtifact "./vc/fceux.zip" - sh: ./pipelines/linux_build.sh From bce4ea30f8a68e1ae13902aae37b36bef696fad7 Mon Sep 17 00:00:00 2001 From: Matt Budd Date: Tue, 16 Jun 2020 21:14:44 -0400 Subject: [PATCH 09/13] Added win32 build script for pipeline. --- appveyor.yml | 6 +----- pipelines/win32_build.bat | 18 ++++++++++++++++++ vc/archive.bat | 2 +- 3 files changed, 20 insertions(+), 6 deletions(-) create mode 100644 pipelines/win32_build.bat diff --git a/appveyor.yml b/appveyor.yml index a83085a7..9337bac1 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -4,9 +4,5 @@ image: - Ubuntu2004 #- Ubuntu1804 build_script: -- cmd: msbuild "./vc/vc14_fceux.sln" -- cmd: cd vc -- cmd: archive.bat -- cmd: cd .. -- cmd: appveyor PushArtifact "./vc/fceux.zip" +- cmd: pipelines/win32_build.bat - sh: ./pipelines/linux_build.sh diff --git a/pipelines/win32_build.bat b/pipelines/win32_build.bat new file mode 100644 index 00000000..4d096e32 --- /dev/null +++ b/pipelines/win32_build.bat @@ -0,0 +1,18 @@ + +set PROJECT_ROOT=%~dp0.. + +REM echo %PROJECT_ROOT% + +msbuild %PROJECT_ROOT%\vc\vc14_fceux.vcxproj + +cd %PROJECT_ROOT%\vc + +REM Copy Executable to output directory +copy vc14_bin_Debug\fceux.exe ..\output\. + +REM Create Zip Archive +archive.bat + +cd %PROJECT_ROOT% + +appveyor PushArtifact "./vc/fceux.zip" diff --git a/vc/archive.bat b/vc/archive.bat index 5ce17a07..dc532337 100644 --- a/vc/archive.bat +++ b/vc/archive.bat @@ -5,7 +5,7 @@ IF ERRORLEVEL 1 IF NOT ERRORLEVEL 2 GOTO UPXFailed cd ..\output ..\vc\zip -X -9 -r ..\vc\fceux.zip fceux.exe fceux.chm taseditor.chm 7z.dll *.dll palettes luaScripts tools move /y ..\vc\fceux.exe . -..\vc\zip -X -9 -r ..\vc\fceux.zip auxlib.lua +REM ..\vc\zip -X -9 -r ..\vc\fceux.zip auxlib.lua cd .. REM vc\zip -X -9 -r vc\fceux.zip documentation cd vc From be6dff9d68897653b7251aa60267b2e8b081638c Mon Sep 17 00:00:00 2001 From: Matt Budd Date: Tue, 16 Jun 2020 21:23:52 -0400 Subject: [PATCH 10/13] Added 7z.dll to zipped package file. --- pipelines/win32_build.bat | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pipelines/win32_build.bat b/pipelines/win32_build.bat index 4d096e32..c4a27643 100644 --- a/pipelines/win32_build.bat +++ b/pipelines/win32_build.bat @@ -7,8 +7,9 @@ msbuild %PROJECT_ROOT%\vc\vc14_fceux.vcxproj cd %PROJECT_ROOT%\vc -REM Copy Executable to output directory +REM Copy Executable and dlls to output directory copy vc14_bin_Debug\fceux.exe ..\output\. +copy vc14_bin_Debug\7z.dll ..\output\. REM Create Zip Archive archive.bat From 5e30f22381c3a41376cbf590e3a47e8d5c40dc66 Mon Sep 17 00:00:00 2001 From: Matt Budd Date: Tue, 16 Jun 2020 21:33:57 -0400 Subject: [PATCH 11/13] Trying out not using archive script and just pushing directly to appveyor artifacts --- pipelines/win32_build.bat | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/pipelines/win32_build.bat b/pipelines/win32_build.bat index c4a27643..0afdbf23 100644 --- a/pipelines/win32_build.bat +++ b/pipelines/win32_build.bat @@ -12,8 +12,10 @@ copy vc14_bin_Debug\fceux.exe ..\output\. copy vc14_bin_Debug\7z.dll ..\output\. REM Create Zip Archive -archive.bat +cd %PROJECT_ROOT% +appveyor PushArtifact output + +REM archive.bat cd %PROJECT_ROOT% -appveyor PushArtifact "./vc/fceux.zip" From 22c58e1a21e251bd75268b97079ccba4401bbd4b Mon Sep 17 00:00:00 2001 From: Matt Budd Date: Tue, 16 Jun 2020 21:45:16 -0400 Subject: [PATCH 12/13] Trying again with artifacts --- pipelines/win32_build.bat | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/pipelines/win32_build.bat b/pipelines/win32_build.bat index 0afdbf23..80a7f657 100644 --- a/pipelines/win32_build.bat +++ b/pipelines/win32_build.bat @@ -12,10 +12,9 @@ copy vc14_bin_Debug\fceux.exe ..\output\. copy vc14_bin_Debug\7z.dll ..\output\. REM Create Zip Archive -cd %PROJECT_ROOT% -appveyor PushArtifact output - -REM archive.bat +archive.bat cd %PROJECT_ROOT% +appveyor PushArtifact %PROJECT_ROOT%\vc\fceux.zip + From 531afbe4040fe566d22cea4c631afca6d15e5783 Mon Sep 17 00:00:00 2001 From: Matt Budd Date: Tue, 16 Jun 2020 21:51:45 -0400 Subject: [PATCH 13/13] Trying again.... --- pipelines/win32_build.bat | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pipelines/win32_build.bat b/pipelines/win32_build.bat index 80a7f657..7821acc9 100644 --- a/pipelines/win32_build.bat +++ b/pipelines/win32_build.bat @@ -12,7 +12,9 @@ copy vc14_bin_Debug\fceux.exe ..\output\. copy vc14_bin_Debug\7z.dll ..\output\. REM Create Zip Archive -archive.bat +REM archive.bat +cd %PROJECT_ROOT%\output +..\vc\zip -X -9 -r ..\vc\fceux.zip fceux.exe fceux.chm taseditor.chm 7z.dll *.dll palettes luaScripts tools cd %PROJECT_ROOT%