From d9be086126878962bb669f6d72b00f6c34472189 Mon Sep 17 00:00:00 2001 From: mart0258 Date: Fri, 11 Dec 2009 03:07:34 +0000 Subject: [PATCH] MinGW - fix some possible build issues and compile time errors --- cmake/fceux.cmake | 125 +++++++++++++++++++++-- src/drivers/sdl/config.cpp | 2 +- src/drivers/win/afxres.h | 3 + src/drivers/win/archive.cpp | 2 +- src/drivers/win/common.h | 13 --- src/drivers/win/help.cpp | 14 +++ src/drivers/win/joystick.h | 2 +- src/drivers/win/main.cpp | 2 + src/drivers/win/memview.cpp | 5 +- src/drivers/win/memview.h | 4 - src/drivers/win/ramwatch.cpp | 2 +- src/drivers/win/replay.cpp | 3 +- src/drivers/win/tasedit.cpp | 6 +- src/drivers/win/tasedit.h | 2 +- src/drivers/win/taseditlib/taseditproj.h | 2 +- src/drivers/win/texthook.cpp | 4 +- src/drivers/win/window.cpp | 18 +++- src/fceu.cpp | 8 +- src/lua-engine.cpp | 6 +- src/types.h | 4 + 20 files changed, 175 insertions(+), 52 deletions(-) diff --git a/cmake/fceux.cmake b/cmake/fceux.cmake index 49a16a3f..a388e857 100644 --- a/cmake/fceux.cmake +++ b/cmake/fceux.cmake @@ -6,7 +6,14 @@ option(FCEUX_FORCE_LE "Build for a little-endian target" OFF) option(FCEUX_FORCE_BE "Build for a big-endian target" OFF) option(FCEUX_FRAMESKIP "Build legacy frameskip code" OFF) -if(NOT WIN32) +if(WIN32) + OPTION (NOWIN32 "Replace Win32 support with SDL" OFF) + if (NOWIN32) + set(WIN32 OFF) + endif(NOWIN32) +endif(WIN32) + +if (NOT WIN32) option(FCEUX_SDL_OPENGL "Build with OpenGL support" ON) find_package(SDL REQUIRED) find_package(ZLIB REQUIRED) @@ -32,6 +39,7 @@ set(SRC_CORE ${CMAKE_SOURCE_DIR}/src/movie.cpp ${CMAKE_SOURCE_DIR}/src/netplay.cpp ${CMAKE_SOURCE_DIR}/src/nsf.cpp + ${CMAKE_SOURCE_DIR}/src/oldmovie.cpp ${CMAKE_SOURCE_DIR}/src/palette.cpp ${CMAKE_SOURCE_DIR}/src/ppu.cpp ${CMAKE_SOURCE_DIR}/src/sound.cpp @@ -42,9 +50,20 @@ set(SRC_CORE ${CMAKE_SOURCE_DIR}/src/wave.cpp ${CMAKE_SOURCE_DIR}/src/x6502.cpp ${CMAKE_SOURCE_DIR}/src/boards/01-222.cpp + ${CMAKE_SOURCE_DIR}/src/boards/103.cpp + ${CMAKE_SOURCE_DIR}/src/boards/106.cpp + ${CMAKE_SOURCE_DIR}/src/boards/108.cpp ${CMAKE_SOURCE_DIR}/src/boards/112.cpp ${CMAKE_SOURCE_DIR}/src/boards/117.cpp + ${CMAKE_SOURCE_DIR}/src/boards/120.cpp + ${CMAKE_SOURCE_DIR}/src/boards/121.cpp + ${CMAKE_SOURCE_DIR}/src/boards/15.cpp ${CMAKE_SOURCE_DIR}/src/boards/164.cpp + ${CMAKE_SOURCE_DIR}/src/boards/175.cpp + ${CMAKE_SOURCE_DIR}/src/boards/176.cpp + ${CMAKE_SOURCE_DIR}/src/boards/177.cpp + ${CMAKE_SOURCE_DIR}/src/boards/178.cpp + ${CMAKE_SOURCE_DIR}/src/boards/179.cpp ${CMAKE_SOURCE_DIR}/src/boards/183.cpp ${CMAKE_SOURCE_DIR}/src/boards/185.cpp ${CMAKE_SOURCE_DIR}/src/boards/186.cpp @@ -53,47 +72,68 @@ set(SRC_CORE ${CMAKE_SOURCE_DIR}/src/boards/199.cpp ${CMAKE_SOURCE_DIR}/src/boards/208.cpp ${CMAKE_SOURCE_DIR}/src/boards/222.cpp + ${CMAKE_SOURCE_DIR}/src/boards/23.cpp ${CMAKE_SOURCE_DIR}/src/boards/235.cpp + ${CMAKE_SOURCE_DIR}/src/boards/253.cpp + ${CMAKE_SOURCE_DIR}/src/boards/3d-block.cpp + ${CMAKE_SOURCE_DIR}/src/boards/411120-c.cpp ${CMAKE_SOURCE_DIR}/src/boards/43.cpp ${CMAKE_SOURCE_DIR}/src/boards/57.cpp ${CMAKE_SOURCE_DIR}/src/boards/603-5052.cpp + ${CMAKE_SOURCE_DIR}/src/boards/68.cpp ${CMAKE_SOURCE_DIR}/src/boards/8157.cpp ${CMAKE_SOURCE_DIR}/src/boards/8237.cpp + ${CMAKE_SOURCE_DIR}/src/boards/830118C.cpp ${CMAKE_SOURCE_DIR}/src/boards/88.cpp ${CMAKE_SOURCE_DIR}/src/boards/90.cpp ${CMAKE_SOURCE_DIR}/src/boards/95.cpp ${CMAKE_SOURCE_DIR}/src/boards/__dummy_mapper.cpp ${CMAKE_SOURCE_DIR}/src/boards/a9711.cpp + ${CMAKE_SOURCE_DIR}/src/boards/a9746.cpp ${CMAKE_SOURCE_DIR}/src/boards/addrlatch.cpp + ${CMAKE_SOURCE_DIR}/src/boards/ax5705.cpp + ${CMAKE_SOURCE_DIR}/src/boards/bandai.cpp ${CMAKE_SOURCE_DIR}/src/boards/bmc13in1jy110.cpp ${CMAKE_SOURCE_DIR}/src/boards/bmc42in1r.cpp ${CMAKE_SOURCE_DIR}/src/boards/bmc64in1nr.cpp ${CMAKE_SOURCE_DIR}/src/boards/bmc70in1.cpp ${CMAKE_SOURCE_DIR}/src/boards/bonza.cpp + ${CMAKE_SOURCE_DIR}/src/boards/bs-5.cpp + ${CMAKE_SOURCE_DIR}/src/boards/copyfami_mmc3.cpp + ${CMAKE_SOURCE_DIR}/src/boards/dance.cpp ${CMAKE_SOURCE_DIR}/src/boards/datalatch.cpp ${CMAKE_SOURCE_DIR}/src/boards/deirom.cpp ${CMAKE_SOURCE_DIR}/src/boards/dream.cpp ${CMAKE_SOURCE_DIR}/src/boards/edu2000.cpp ${CMAKE_SOURCE_DIR}/src/boards/fk23c.cpp + ${CMAKE_SOURCE_DIR}/src/boards/ghostbusters63in1.cpp + ${CMAKE_SOURCE_DIR}/src/boards/gs-2004.cpp + ${CMAKE_SOURCE_DIR}/src/boards/gs-2013.cpp ${CMAKE_SOURCE_DIR}/src/boards/h2288.cpp ${CMAKE_SOURCE_DIR}/src/boards/karaoke.cpp ${CMAKE_SOURCE_DIR}/src/boards/kof97.cpp ${CMAKE_SOURCE_DIR}/src/boards/konami-qtai.cpp + ${CMAKE_SOURCE_DIR}/src/boards/ks7032.cpp ${CMAKE_SOURCE_DIR}/src/boards/malee.cpp ${CMAKE_SOURCE_DIR}/src/boards/mmc1.cpp ${CMAKE_SOURCE_DIR}/src/boards/mmc3.cpp ${CMAKE_SOURCE_DIR}/src/boards/mmc5.cpp ${CMAKE_SOURCE_DIR}/src/boards/n-c22m.cpp ${CMAKE_SOURCE_DIR}/src/boards/n106.cpp + ${CMAKE_SOURCE_DIR}/src/boards/n625092.cpp ${CMAKE_SOURCE_DIR}/src/boards/novel.cpp ${CMAKE_SOURCE_DIR}/src/boards/sachen.cpp + ${CMAKE_SOURCE_DIR}/src/boards/sc-127.cpp ${CMAKE_SOURCE_DIR}/src/boards/sheroes.cpp ${CMAKE_SOURCE_DIR}/src/boards/sl1632.cpp + ${CMAKE_SOURCE_DIR}/src/boards/smb2j.cpp ${CMAKE_SOURCE_DIR}/src/boards/subor.cpp ${CMAKE_SOURCE_DIR}/src/boards/super24.cpp ${CMAKE_SOURCE_DIR}/src/boards/supervision.cpp + ${CMAKE_SOURCE_DIR}/src/boards/t-227-1.cpp ${CMAKE_SOURCE_DIR}/src/boards/t-262.cpp ${CMAKE_SOURCE_DIR}/src/boards/tengen.cpp + ${CMAKE_SOURCE_DIR}/src/boards/tf-1201.cpp ${CMAKE_SOURCE_DIR}/src/input/arkanoid.cpp ${CMAKE_SOURCE_DIR}/src/input/bworld.cpp ${CMAKE_SOURCE_DIR}/src/input/cursor.cpp @@ -109,13 +149,11 @@ set(SRC_CORE ${CMAKE_SOURCE_DIR}/src/input/suborkb.cpp ${CMAKE_SOURCE_DIR}/src/input/toprider.cpp ${CMAKE_SOURCE_DIR}/src/input/zapper.cpp - ${CMAKE_SOURCE_DIR}/src/mappers/15.cpp ${CMAKE_SOURCE_DIR}/src/mappers/151.cpp ${CMAKE_SOURCE_DIR}/src/mappers/16.cpp ${CMAKE_SOURCE_DIR}/src/mappers/17.cpp ${CMAKE_SOURCE_DIR}/src/mappers/18.cpp ${CMAKE_SOURCE_DIR}/src/mappers/193.cpp - ${CMAKE_SOURCE_DIR}/src/mappers/200.cpp ${CMAKE_SOURCE_DIR}/src/mappers/201.cpp ${CMAKE_SOURCE_DIR}/src/mappers/202.cpp ${CMAKE_SOURCE_DIR}/src/mappers/203.cpp @@ -131,12 +169,10 @@ set(SRC_CORE ${CMAKE_SOURCE_DIR}/src/mappers/227.cpp ${CMAKE_SOURCE_DIR}/src/mappers/228.cpp ${CMAKE_SOURCE_DIR}/src/mappers/229.cpp - ${CMAKE_SOURCE_DIR}/src/mappers/23.cpp ${CMAKE_SOURCE_DIR}/src/mappers/230.cpp ${CMAKE_SOURCE_DIR}/src/mappers/231.cpp ${CMAKE_SOURCE_DIR}/src/mappers/232.cpp ${CMAKE_SOURCE_DIR}/src/mappers/234.cpp - ${CMAKE_SOURCE_DIR}/src/mappers/240.cpp ${CMAKE_SOURCE_DIR}/src/mappers/241.cpp ${CMAKE_SOURCE_DIR}/src/mappers/242.cpp ${CMAKE_SOURCE_DIR}/src/mappers/244.cpp @@ -150,7 +186,6 @@ set(SRC_CORE ${CMAKE_SOURCE_DIR}/src/mappers/40.cpp ${CMAKE_SOURCE_DIR}/src/mappers/41.cpp ${CMAKE_SOURCE_DIR}/src/mappers/42.cpp - ${CMAKE_SOURCE_DIR}/src/mappers/43.cpp ${CMAKE_SOURCE_DIR}/src/mappers/46.cpp ${CMAKE_SOURCE_DIR}/src/mappers/50.cpp ${CMAKE_SOURCE_DIR}/src/mappers/51.cpp @@ -161,7 +196,6 @@ set(SRC_CORE ${CMAKE_SOURCE_DIR}/src/mappers/62.cpp ${CMAKE_SOURCE_DIR}/src/mappers/65.cpp ${CMAKE_SOURCE_DIR}/src/mappers/67.cpp - ${CMAKE_SOURCE_DIR}/src/mappers/68.cpp ${CMAKE_SOURCE_DIR}/src/mappers/69.cpp ${CMAKE_SOURCE_DIR}/src/mappers/71.cpp ${CMAKE_SOURCE_DIR}/src/mappers/72.cpp @@ -181,10 +215,10 @@ set(SRC_CORE ${CMAKE_SOURCE_DIR}/src/mappers/92.cpp ${CMAKE_SOURCE_DIR}/src/mappers/97.cpp ${CMAKE_SOURCE_DIR}/src/mappers/99.cpp - ${CMAKE_SOURCE_DIR}/src/mappers/__226.cpp ${CMAKE_SOURCE_DIR}/src/mappers/emu2413.c ${CMAKE_SOURCE_DIR}/src/mappers/mmc2and4.cpp ${CMAKE_SOURCE_DIR}/src/mappers/simple.cpp + ${CMAKE_SOURCE_DIR}/src/utils/ConvertUTF.c ${CMAKE_SOURCE_DIR}/src/utils/crc32.cpp ${CMAKE_SOURCE_DIR}/src/utils/endian.cpp ${CMAKE_SOURCE_DIR}/src/utils/general.cpp @@ -224,9 +258,40 @@ if(FCEUX_SDL_OPENGL) endif(FCEUX_SDL_OPENGL) set(SRC_DRIVERS_WIN + ${CMAKE_SOURCE_DIR}/src/lua-engine.cpp + ${CMAKE_SOURCE_DIR}/src/lua/src/lapi.c + ${CMAKE_SOURCE_DIR}/src/lua/src/lauxlib.c + ${CMAKE_SOURCE_DIR}/src/lua/src/lbaselib.c + ${CMAKE_SOURCE_DIR}/src/lua/src/lcode.c + ${CMAKE_SOURCE_DIR}/src/lua/src/ldblib.c + ${CMAKE_SOURCE_DIR}/src/lua/src/ldebug.c + ${CMAKE_SOURCE_DIR}/src/lua/src/ldo.c + ${CMAKE_SOURCE_DIR}/src/lua/src/ldump.c + ${CMAKE_SOURCE_DIR}/src/lua/src/lfunc.c + ${CMAKE_SOURCE_DIR}/src/lua/src/lgc.c + ${CMAKE_SOURCE_DIR}/src/lua/src/linit.c + ${CMAKE_SOURCE_DIR}/src/lua/src/liolib.c + ${CMAKE_SOURCE_DIR}/src/lua/src/llex.c + ${CMAKE_SOURCE_DIR}/src/lua/src/lmathlib.c + ${CMAKE_SOURCE_DIR}/src/lua/src/lmem.c + ${CMAKE_SOURCE_DIR}/src/lua/src/loadlib.c + ${CMAKE_SOURCE_DIR}/src/lua/src/lobject.c + ${CMAKE_SOURCE_DIR}/src/lua/src/lopcodes.c + ${CMAKE_SOURCE_DIR}/src/lua/src/loslib.c + ${CMAKE_SOURCE_DIR}/src/lua/src/lparser.c + ${CMAKE_SOURCE_DIR}/src/lua/src/lstate.c + ${CMAKE_SOURCE_DIR}/src/lua/src/lstring.c + ${CMAKE_SOURCE_DIR}/src/lua/src/lstrlib.c + ${CMAKE_SOURCE_DIR}/src/lua/src/ltable.c + ${CMAKE_SOURCE_DIR}/src/lua/src/ltablib.c + ${CMAKE_SOURCE_DIR}/src/lua/src/ltm.c + ${CMAKE_SOURCE_DIR}/src/lua/src/lundump.c + ${CMAKE_SOURCE_DIR}/src/lua/src/lvm.c + ${CMAKE_SOURCE_DIR}/src/lua/src/lzio.c + ${CMAKE_SOURCE_DIR}/src/lua/src/print.c + ${CMAKE_SOURCE_DIR}/src/drivers/win/archive.cpp ${CMAKE_SOURCE_DIR}/src/drivers/win/args.cpp ${CMAKE_SOURCE_DIR}/src/drivers/win/aviout.cpp - ${CMAKE_SOURCE_DIR}/src/drivers/win/basicbot.cpp ${CMAKE_SOURCE_DIR}/src/drivers/win/cdlogger.cpp ${CMAKE_SOURCE_DIR}/src/drivers/win/cheat.cpp ${CMAKE_SOURCE_DIR}/src/drivers/win/common.cpp @@ -241,11 +306,13 @@ set(SRC_DRIVERS_WIN ${CMAKE_SOURCE_DIR}/src/drivers/win/joystick.cpp ${CMAKE_SOURCE_DIR}/src/drivers/win/keyboard.cpp ${CMAKE_SOURCE_DIR}/src/drivers/win/log.cpp + ${CMAKE_SOURCE_DIR}/src/drivers/win/luaconsole.cpp ${CMAKE_SOURCE_DIR}/src/drivers/win/main.cpp ${CMAKE_SOURCE_DIR}/src/drivers/win/mapinput.cpp ${CMAKE_SOURCE_DIR}/src/drivers/win/memview.cpp ${CMAKE_SOURCE_DIR}/src/drivers/win/memviewsp.cpp ${CMAKE_SOURCE_DIR}/src/drivers/win/memwatch.cpp + ${CMAKE_SOURCE_DIR}/src/drivers/win/movieoptions.cpp ${CMAKE_SOURCE_DIR}/src/drivers/win/monitor.cpp ${CMAKE_SOURCE_DIR}/src/drivers/win/netplay.cpp ${CMAKE_SOURCE_DIR}/src/drivers/win/ntview.cpp @@ -253,17 +320,22 @@ set(SRC_DRIVERS_WIN ${CMAKE_SOURCE_DIR}/src/drivers/win/palette.cpp ${CMAKE_SOURCE_DIR}/src/drivers/win/ppuview.cpp ${CMAKE_SOURCE_DIR}/src/drivers/win/pref.cpp + ${CMAKE_SOURCE_DIR}/src/drivers/win/ram_search.cpp + ${CMAKE_SOURCE_DIR}/src/drivers/win/ramwatch.cpp ${CMAKE_SOURCE_DIR}/src/drivers/win/replay.cpp ${CMAKE_SOURCE_DIR}/src/drivers/win/res.rc ${CMAKE_SOURCE_DIR}/src/drivers/win/sound.cpp ${CMAKE_SOURCE_DIR}/src/drivers/win/state.cpp ${CMAKE_SOURCE_DIR}/src/drivers/win/tasedit.cpp + ${CMAKE_SOURCE_DIR}/src/drivers/win/taseditlib/taseditproj.cpp + ${CMAKE_SOURCE_DIR}/src/drivers/win/texthook.cpp ${CMAKE_SOURCE_DIR}/src/drivers/win/throttle.cpp ${CMAKE_SOURCE_DIR}/src/drivers/win/timing.cpp ${CMAKE_SOURCE_DIR}/src/drivers/win/tracer.cpp ${CMAKE_SOURCE_DIR}/src/drivers/win/video.cpp ${CMAKE_SOURCE_DIR}/src/drivers/win/wave.cpp ${CMAKE_SOURCE_DIR}/src/drivers/win/window.cpp + ${CMAKE_SOURCE_DIR}/src/drivers/win/Win32InputBox.cpp ${CMAKE_SOURCE_DIR}/src/drivers/win/zlib/adler32.c ${CMAKE_SOURCE_DIR}/src/drivers/win/zlib/compress.c ${CMAKE_SOURCE_DIR}/src/drivers/win/zlib/crc32.c @@ -278,6 +350,7 @@ set(SRC_DRIVERS_WIN ${CMAKE_SOURCE_DIR}/src/drivers/win/zlib/trees.c ${CMAKE_SOURCE_DIR}/src/drivers/win/zlib/uncompr.c ${CMAKE_SOURCE_DIR}/src/drivers/win/zlib/zutil.c + # ${CMAKE_SOURCE_DIR}/src/drivers/res.rc ) set(CMAKE_INCLUDE_CURRENT_DIR ON) @@ -349,14 +422,46 @@ add_executable( ${FCEUX_EXE_NAME} ${SOURCES} ) if(WIN32) add_dependencies( ${FCEUX_EXE_NAME} InstallHelpFile ) + #add_dependencies( ${FCEUX_EXE_NAME} res.o) + #add_custom_command( + # OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/res.o + # COMMAND windres + # ARGS ${CMAKE_SOURCE_DIR}/src/drivers/win/res.rc ${CMAKE_CURRENT_BINARY_DIR}/res.o --use-temp-file -D_WIN_IE=0x300 + # MAIN_DEPENDENCY ${CMAKE_SOURCE_DIR}/src/drivers/win/res.rc + #) + set(OUTPUT_RES_RC_O CMakeFiles/${FCEUX_EXE_NAME}.dir/__/__/__/src/drivers/win/res.rc.o) + add_custom_command( + OUTPUT ${OUTPUT_RES_RC_O} + COMMAND windres -o ${OUTPUT_RES_RC_O} ${CMAKE_SOURCE_DIR}/src/drivers/win/res.rc + DEPENDS ${CMAKE_SOURCE_DIR}/src/drivers/win/res.rc + VERBATIM + ) + add_custom_target( + BuildResourceFileFor${FCEUX_EXE_NAME} + DEPENDS ${OUTPUT_RES_RC_O} + ) + set(DEFINED_BUILD_RESOURCE_FILE TRUE CACHE GLOBAL "This is a hack to get CMake to build the .rc file") + + add_dependencies( ${FCEUX_EXE_NAME} BuildResourceFileFor${FCEUX_EXE_NAME} ) + set_property( + TARGET ${FCEUX_EXE_NAME} + PROPERTY LINK_FLAGS ${OUTPUT_RES_RC_O} + ) - target_link_libraries( ${FCEUX_EXE_NAME} rpcrt4 comctl32 vfw32 winmm ws2_32 htmlhelp + target_link_libraries( ${FCEUX_EXE_NAME} rpcrt4 comctl32 vfw32 winmm ws2_32 comdlg32 ole32 gdi32 dsound dxguid ddraw dinput ) + if(MINGW) + include_directories(${CMAKE_SOURCE_DIR}/src/drivers/win/lua/include/) + else(MINGW) + target_link_libraries( ${FCEUX_EXE_NAME} htmlhelp) + endif(MINGW) else(WIN32) target_link_libraries( ${FCEUX_EXE_NAME} ${SDL_LIBRARY} ${ZLIB_LIBRARIES} ) if(FCEUX_SDL_OPENGL) target_link_libraries( ${FCEUX_EXE_NAME} ${OPENGL_gl_LIBRARY} ) endif(FCEUX_SDL_OPENGL) endif(WIN32) + + diff --git a/src/drivers/sdl/config.cpp b/src/drivers/sdl/config.cpp index b105a56d..e5ee27a8 100644 --- a/src/drivers/sdl/config.cpp +++ b/src/drivers/sdl/config.cpp @@ -55,7 +55,7 @@ CreateDirs(const std::string &dir) std::string subdir; int x; -#ifdef WIN32 +#if defined(WIN32) || defined(NEED_MINGW_HACKS) mkdir(dir.c_str()); for(x = 0; x < 6; x++) { subdir = dir + PSS + subs[x]; diff --git a/src/drivers/win/afxres.h b/src/drivers/win/afxres.h index 91e7f495..61b37b9f 100644 --- a/src/drivers/win/afxres.h +++ b/src/drivers/win/afxres.h @@ -2,6 +2,9 @@ #define _AFXRES_H #if __GNUC__ >= 3 #pragma GCC system_header + +// MINGW hack for Commctrl.h +#define _WIN32_IE 0x0600 #endif #ifdef __cplusplus diff --git a/src/drivers/win/archive.cpp b/src/drivers/win/archive.cpp index 02468408..108d252d 100644 --- a/src/drivers/win/archive.cpp +++ b/src/drivers/win/archive.cpp @@ -246,7 +246,7 @@ public: if (origin < 3) { - std::ios::off_type offtype; + std::ios::seekdir offtype; switch(origin) { case 0: offtype = std::ios::beg; break; diff --git a/src/drivers/win/common.h b/src/drivers/win/common.h index 4f520341..ad20d8e3 100644 --- a/src/drivers/win/common.h +++ b/src/drivers/win/common.h @@ -16,19 +16,6 @@ #define DIRECTDRAW_VERSION 0x0700 #define DIRECTINPUT_VERSION 0x700 -#ifdef NEED_MINGW_HACKS -typedef struct _HD_HITTESTINFO HDHITTESTINFO; -// Pulled from wine's commctrl.h: -typedef struct tagNMLVODSTATECHANGE -{ - NMHDR hdr; - int iFrom; - int iTo; - UINT uNewState; - UINT uOldState; -} NMLVODSTATECHANGE, *LPNMLVODSTATECHANGE; -#endif - //#define FCEUDEF_DEBUGGER //mbg merge 7/17/06 removing conditional compiles #include "../../types.h" #include "../../file.h" diff --git a/src/drivers/win/help.cpp b/src/drivers/win/help.cpp index 3ff79447..011f4ab9 100644 --- a/src/drivers/win/help.cpp +++ b/src/drivers/win/help.cpp @@ -1,5 +1,17 @@ #include "main.h" #include "help.h" + +#ifdef NEED_MINGW_HACKS + +using std::string; + +void OpenHelpWindow(string subpage) +{ + // TODO: Implement replacement for MinGW. +} + +#else + #include using std::string; @@ -12,3 +24,5 @@ void OpenHelpWindow(string subpage) helpFileName = helpFileName + "::/" + subpage + ".htm"; HtmlHelp(GetDesktopWindow(), helpFileName.c_str(), HH_DISPLAY_TOPIC, (DWORD)NULL); } + +#endif \ No newline at end of file diff --git a/src/drivers/win/joystick.h b/src/drivers/win/joystick.h index 0a773c6c..4b524c8e 100644 --- a/src/drivers/win/joystick.h +++ b/src/drivers/win/joystick.h @@ -24,4 +24,4 @@ void JoystickSetBackgroundAccessBit(int bit); void JoystickClearBackgroundAccessBit(int bit); void JoystickSetBackgroundAccess(bool on); -#endif \ No newline at end of file +#endif diff --git a/src/drivers/win/main.cpp b/src/drivers/win/main.cpp index 5408a69f..6097af2e 100644 --- a/src/drivers/win/main.cpp +++ b/src/drivers/win/main.cpp @@ -422,7 +422,9 @@ void DoFCEUExit() FCEUI_StopMovie(); FCEUD_AviStop(); + #ifdef _S9XLUA_H FCEU_LuaStop(); // kill lua script before the gui dies + #endif exiting = 1; closeGame = true;//mbg 6/30/06 - for housekeeping purposes we need to exit after the emulation cycle finishes diff --git a/src/drivers/win/memview.cpp b/src/drivers/win/memview.cpp index 5b02f5a8..cd66a6f2 100644 --- a/src/drivers/win/memview.cpp +++ b/src/drivers/win/memview.cpp @@ -120,6 +120,9 @@ LRESULT CALLBACK MemViewCallB(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa BOOL CALLBACK MemFindCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam); void FindNext(); void OpenFindDialog(); +static int GetFileData(uint32 offset); +static int WriteFileData(uint32 offset,int data); + HWND hMemView, hMemFind; HDC mDC; @@ -138,7 +141,7 @@ int MemFind_wndx, MemFind_wndy; int MemViewSizeX=625,MemViewSizeY=242; static RECT newMemViewRect; -char chartable[256]; +static char chartable[256]; //SCROLLINFO memsi; //HBITMAP HDataBmp; diff --git a/src/drivers/win/memview.h b/src/drivers/win/memview.h index a6e7360b..3485aa96 100644 --- a/src/drivers/win/memview.h +++ b/src/drivers/win/memview.h @@ -6,10 +6,6 @@ void ChangeMemViewFocus(int newEditingMode, int StartOffset,int EndOffset); void ApplyPatch(int addr,int size, uint8* data); void UndoLastPatch(); -int GetFileData(uint32 offset); -int WriteFileData(uint32 offset,int data); -int GetRomFileSize(); -void FlushUndoBuffer(); extern HWND hMemView; extern int EditingMode; diff --git a/src/drivers/win/ramwatch.cpp b/src/drivers/win/ramwatch.cpp index 11a876dc..f4e8a354 100644 --- a/src/drivers/win/ramwatch.cpp +++ b/src/drivers/win/ramwatch.cpp @@ -970,7 +970,7 @@ LRESULT CALLBACK RamWatchProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam Item->item.pszText = num; } return true; case 2: - Item->item.pszText = rswatches[iNum].comment ? rswatches[iNum].comment : ""; + Item->item.pszText = rswatches[iNum].comment ? rswatches[iNum].comment : (char*)""; return true; default: diff --git a/src/drivers/win/replay.cpp b/src/drivers/win/replay.cpp index 7906026e..4ef52a2a 100644 --- a/src/drivers/win/replay.cpp +++ b/src/drivers/win/replay.cpp @@ -355,8 +355,7 @@ BOOL CALLBACK ReplayMetadataDialogProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, L //Display Subtitle Heading if (currSubtitles.size() > 0) //If no subtitles, don't bother with this heading { - string Heading = "SUBTITLES"; - std::wstring& rHeading = mbstowcs(Heading); + std::wstring rHeading = mbstowcs(string("SUBTITLES")); LVITEM lvSubtitle; lvSubtitle.iItem = 0; diff --git a/src/drivers/win/tasedit.cpp b/src/drivers/win/tasedit.cpp index 62e0c1c6..7e696c35 100644 --- a/src/drivers/win/tasedit.cpp +++ b/src/drivers/win/tasedit.cpp @@ -88,10 +88,6 @@ static void GetDispInfo(NMLVDISPINFO* nmlvDispInfo) } } -#define CDDS_ITEMPREPAINT (CDDS_ITEM | CDDS_PREPAINT) -#define CDDS_ITEMPOSTPAINT (CDDS_ITEM | CDDS_POSTPAINT) -#define CDDS_ITEMPREERASE (CDDS_ITEM | CDDS_PREERASE) -#define CDDS_ITEMPOSTERASE (CDDS_ITEM | CDDS_POSTERASE) #define CDDS_SUBITEMPREPAINT (CDDS_SUBITEM | CDDS_ITEMPREPAINT) #define CDDS_SUBITEMPOSTPAINT (CDDS_SUBITEM | CDDS_ITEMPOSTPAINT) #define CDDS_SUBITEMPREERASE (CDDS_SUBITEM | CDDS_ITEMPREERASE) @@ -677,7 +673,7 @@ static LRESULT APIENTRY HeaderWndProc(HWND hWnd,UINT msg,WPARAM wParam,LPARAM lP case WM_LBUTTONDOWN: { //perform hit test - HDHITTESTINFO info; + HD_HITTESTINFO info; info.pt.x = GET_X_LPARAM(lParam); info.pt.y = GET_Y_LPARAM(lParam); SendMessage(hWnd,HDM_HITTEST,0,(LPARAM)&info); diff --git a/src/drivers/win/tasedit.h b/src/drivers/win/tasedit.h index 06dbdef3..3aea264d 100644 --- a/src/drivers/win/tasedit.h +++ b/src/drivers/win/tasedit.h @@ -1,2 +1,2 @@ void DoTasEdit(); -void UpdateTasEdit(); \ No newline at end of file +void UpdateTasEdit(); diff --git a/src/drivers/win/taseditlib/taseditproj.h b/src/drivers/win/taseditlib/taseditproj.h index c517bdfd..593039d8 100644 --- a/src/drivers/win/taseditlib/taseditproj.h +++ b/src/drivers/win/taseditlib/taseditproj.h @@ -36,4 +36,4 @@ private: // If there are unsaved changes. bool changed; -}; \ No newline at end of file +}; diff --git a/src/drivers/win/texthook.cpp b/src/drivers/win/texthook.cpp index 63d0ae3a..91ce78fd 100644 --- a/src/drivers/win/texthook.cpp +++ b/src/drivers/win/texthook.cpp @@ -71,7 +71,7 @@ uint8 tileToggles[32][30]; //keeps track of which tiles in the selection window uint8 pausedTileToggles[32][30]; //same as above, but is used during the emulator's paused state int lmousedown = 0; //keeps track of the the left mousebuttons down state (for click/drag selection) int drawingorerasing = 1; //keeps track of whether the user is selecting or deselecting on the selection window -char chartable[256][4]; //used for table mappings +static char chartable[256][4]; //used for table mappings static int TableFileLoaded = 0; //boolean for whether a table file is loaded or not uint16 tile = 0x0000; //used to store the value of a tile at a given x,y location int tileattr = 0; //used to store the corresponding attribute location for tile (see getTextHookerTile) @@ -781,7 +781,7 @@ BOOL CALLBACK TextHookerCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa char str[2048]; char bufferstr[10240]; //holds the entire buffer, so it needs to be big... char bufferstrtemp[10240]; - void* found = "\0"; + void* found = (void*)"\0"; char binstring[165]; char byteline[165]; int bytecounter; diff --git a/src/drivers/win/window.cpp b/src/drivers/win/window.cpp index f0c747b8..48864f8b 100644 --- a/src/drivers/win/window.cpp +++ b/src/drivers/win/window.cpp @@ -513,6 +513,7 @@ void UpdateContextMenuItems(HMENU context, int whichContext) EnableMenuItem(context,FCEUX_CONTEXT_RECENTROM1,MF_BYCOMMAND | MF_GRAYED); //Add Lua separator if either lua condition is true (yeah, a little ugly but it works) + #ifdef _S9XLUA_H if (recent_lua[0] || FCEU_LuaRunning()) InsertMenu(context, 0xFFFF, MF_SEPARATOR, 0, ""); @@ -523,6 +524,7 @@ void UpdateContextMenuItems(HMENU context, int whichContext) //If lua is loaded, add a stop lua item if (FCEU_LuaRunning()) InsertMenu(context, 0xFFFF, MF_BYCOMMAND, FCEUX_CONTEXT_CLOSELUAWINDOWS, "Close All Script Windows"); + #endif //If menu is hidden, add an Unhide menu option if (tog) @@ -1355,8 +1357,10 @@ LRESULT FAR PASCAL AppWndProc(HWND hWnd,UINT msg,WPARAM wParam,LPARAM lParam) //------------------------------------------------------- //Check if Lua file //------------------------------------------------------- + #ifdef _S9XLUA_H else if (!(fileDropped.find(".lua") == string::npos) && (fileDropped.find(".lua") == fileDropped.length()-4)) FCEU_LoadLuaCode(ftmp); + #endif //------------------------------------------------------- //Check if Ram Watch file //------------------------------------------------------- @@ -1403,6 +1407,7 @@ LRESULT FAR PASCAL AppWndProc(HWND hWnd,UINT msg,WPARAM wParam,LPARAM lParam) } // A menu item for the recent lua files menu was clicked. + #ifdef _S9XLUA_H if(wParam >= LUA_FIRST_RECENT_FILE && wParam <= LUA_FIRST_RECENT_FILE + MAX_NUMBER_OF_LUA_RECENT_FILES - 1) { char*& fname = recent_lua[wParam - LUA_FIRST_RECENT_FILE]; @@ -1420,6 +1425,7 @@ LRESULT FAR PASCAL AppWndProc(HWND hWnd,UINT msg,WPARAM wParam,LPARAM lParam) } } } + #endif // A menu item for the recent movie files menu was clicked. if(wParam >= MOVIE_FIRST_RECENT_FILE && wParam <= MOVIE_FIRST_RECENT_FILE + MAX_NUMBER_OF_MOVIE_RECENT_FILES - 1) @@ -1529,6 +1535,7 @@ LRESULT FAR PASCAL AppWndProc(HWND hWnd,UINT msg,WPARAM wParam,LPARAM lParam) PostMessage(LuaConsoleHWnd, WM_CLOSE, 0, 0); break; //Recent Lua 1 + #ifdef _S9XLUA_H case FCEUX_CONTEXT_LOADLASTLUA: if(recent_lua[0]) { @@ -1544,6 +1551,7 @@ LRESULT FAR PASCAL AppWndProc(HWND hWnd,UINT msg,WPARAM wParam,LPARAM lParam) } } break; + #endif case MENU_EXIT: DoFCEUExit(); @@ -1716,10 +1724,12 @@ LRESULT FAR PASCAL AppWndProc(HWND hWnd,UINT msg,WPARAM wParam,LPARAM lParam) break; case ID_CONFIG_SAVECONFIGFILE: - extern string cfgFile; - sprintf(TempArray, "%s/%s", BaseDirectory.c_str(),cfgFile.c_str()); - SaveConfig(TempArray); - break; + { + extern string cfgFile; + sprintf(TempArray, "%s/%s", BaseDirectory.c_str(),cfgFile.c_str()); + SaveConfig(TempArray); + break; + } //Tools Menu--------------------------------------------------------------- case MENU_CHEATS: diff --git a/src/fceu.cpp b/src/fceu.cpp index 29a68c13..7810cc68 100644 --- a/src/fceu.cpp +++ b/src/fceu.cpp @@ -95,7 +95,7 @@ FCEUGI::~FCEUGI() if(archiveFilename) delete archiveFilename; } -static void CloseGame(void) +static void FCEU_CloseGame(void) { if(GameInfo) { @@ -352,7 +352,7 @@ static DECLFR(ARAMH) void ResetGameLoaded(void) { - if(GameInfo) CloseGame(); + if(GameInfo) FCEU_CloseGame(); EmulationPaused = 0; //mbg 5/8/08 - loading games while paused was bad news. maybe this fixes it GameStateRestore=0; PPU_hook=0; @@ -413,7 +413,7 @@ FCEUGI *FCEUI_LoadGameVirtual(const char *name, int OverwriteVidMode) for (AutosaveIndex=0; AutosaveIndex start; } +#else __forceinline bool Contains(unsigned int address, int size) const { return address < end && address+size > start; } +#endif }; std::vector islands; @@ -4534,7 +4538,7 @@ int FCEU_LoadLuaCode(const char *filename) { L = lua_open(); luaL_openlibs(L); - #ifdef WIN32 + #if defined( WIN32) && !defined(NEED_MINGW_HACKS) iuplua_open(L); iupcontrolslua_open(L); #endif diff --git a/src/types.h b/src/types.h index 0d20773f..e8bec90a 100644 --- a/src/types.h +++ b/src/types.h @@ -117,6 +117,10 @@ typedef uint32_t uint32; #define PSS ":" #define PS ':' +#else + +#error PSS_STYLE undefined or invalid; see "types.h" for possible values, and add as compile-time option. + #endif