From 2afbc94734a29eba6571712d492885f06d296e40 Mon Sep 17 00:00:00 2001 From: Henrik Rydgard Date: Sun, 9 Jun 2013 13:02:16 +0200 Subject: [PATCH] Turn off RTTI, simulate it where needed. --- Common/Common.vcxproj | 4 ++++ Core/Core.vcxproj | 4 ++++ Core/Dialog/SavedataParam.cpp | 2 +- Core/HLE/sceKernel.h | 12 +++++++----- Core/HLE/sceKernelModule.cpp | 2 +- Core/HLE/sceKernelThread.cpp | 8 +++----- GPU/GPU.vcxproj | 4 ++++ UI/MenuScreens.cpp | 8 ++++---- UI/UI.vcxproj | 4 ++++ Windows/PPSSPP.vcxproj | 4 ++++ android/jni/Android.mk | 4 ++-- android/jni/Application.mk | 2 +- ext/libkirk/libkirk.vcxproj | 4 ++++ ext/zlib/zlib.vcxproj | 4 ++++ headless/Headless.vcxproj | 4 ++++ native | 2 +- unittest/UnitTests.vcxproj | 4 ++++ 17 files changed, 56 insertions(+), 20 deletions(-) diff --git a/Common/Common.vcxproj b/Common/Common.vcxproj index 11d1c1b3a6..0095221811 100644 --- a/Common/Common.vcxproj +++ b/Common/Common.vcxproj @@ -74,6 +74,7 @@ Fast true false + false Windows @@ -97,6 +98,7 @@ false true false + false Windows @@ -121,6 +123,7 @@ ../native Speed true + false Windows @@ -148,6 +151,7 @@ Speed false true + false Windows diff --git a/Core/Core.vcxproj b/Core/Core.vcxproj index 15613de74b..4997efdf63 100644 --- a/Core/Core.vcxproj +++ b/Core/Core.vcxproj @@ -72,6 +72,7 @@ Fast true false + false true @@ -92,6 +93,7 @@ false true false + false true @@ -115,6 +117,7 @@ Speed MultiThreadedDLL true + false true @@ -145,6 +148,7 @@ false true USE_FFMPEG;_CRT_SECURE_NO_WARNINGS;_MBCS;%(PreprocessorDefinitions) + false true diff --git a/Core/Dialog/SavedataParam.cpp b/Core/Dialog/SavedataParam.cpp index b3cdb57b4b..97a2e12dc1 100644 --- a/Core/Dialog/SavedataParam.cpp +++ b/Core/Dialog/SavedataParam.cpp @@ -361,7 +361,7 @@ bool SavedataParam::Save(SceUtilitySavedataParam* param, const std::string &save { int offset = sfoFile.GetDataOffset(sfoData,"SAVEDATA_PARAMS"); if(offset >= 0) - UpdateHash(sfoData, sfoSize, offset, (param->key[0]?3:1)); + UpdateHash(sfoData, (int)sfoSize, offset, (param->key[0] ? 3 : 1)); } WritePSPFile(sfopath, sfoData, (SceSize)sfoSize); delete[] sfoData; diff --git a/Core/HLE/sceKernel.h b/Core/HLE/sceKernel.h index 3a6f31ca25..53a3b54114 100644 --- a/Core/HLE/sceKernel.h +++ b/Core/HLE/sceKernel.h @@ -448,7 +448,10 @@ public: } else { - T* t = dynamic_cast(pool[handle - handleOffset]); + // Previously we had a dynamic_cast here, but since RTTI was disabled traditionally, + // it just acted as a static case and everything worked. This means that we will never + // see the Wrong type object error below, but we'll just have to live with that danger. + T* t = static_cast(pool[handle - handleOffset]); if (t == 0) { ERROR_LOG(HLE, "Kernel: Wrong type object %i (%08x)", handle, handle); @@ -474,15 +477,14 @@ public: } template - void Iterate(bool func(T *, ArgT), ArgT arg) + void Iterate(bool func(T *, ArgT), ArgT arg, int type) { for (int i = 0; i < maxCount; i++) { if (!occupied[i]) continue; - T *t = dynamic_cast(pool[i]); - if (t) - { + T *t = static_cast(pool[i]); + if (t->GetIDType() == type) { if (!func(t, arg)) break; } diff --git a/Core/HLE/sceKernelModule.cpp b/Core/HLE/sceKernelModule.cpp index 7bf918bf82..9cf8a1853e 100644 --- a/Core/HLE/sceKernelModule.cpp +++ b/Core/HLE/sceKernelModule.cpp @@ -1319,7 +1319,7 @@ u32 sceKernelGetModuleIdByAddress(u32 moduleAddr) state.addr = moduleAddr; state.result = SCE_KERNEL_ERROR_UNKNOWN_MODULE; - kernelObjects.Iterate(&__GetModuleIdByAddressIterator, &state); + kernelObjects.Iterate(&__GetModuleIdByAddressIterator, &state, PPSSPP_KERNEL_TMID_Module); if (state.result == SCE_KERNEL_ERROR_UNKNOWN_MODULE) ERROR_LOG(HLE, "sceKernelGetModuleIdByAddress(%08x): module not found", moduleAddr) else diff --git a/Core/HLE/sceKernelThread.cpp b/Core/HLE/sceKernelThread.cpp index e187966f99..d2e71037aa 100644 --- a/Core/HLE/sceKernelThread.cpp +++ b/Core/HLE/sceKernelThread.cpp @@ -2819,15 +2819,13 @@ void ActionAfterMipsCall::run(MipsCall &call) { ActionAfterMipsCall *Thread::getRunningCallbackAction() { - if (this->GetUID() == currentThread && g_inCbCount > 0) - { + if (this->GetUID() == currentThread && g_inCbCount > 0) { MipsCall *call = mipsCalls.get(this->currentMipscallId); ActionAfterMipsCall *action = 0; if (call) - action = dynamic_cast(call->doAfter); + action = static_cast(call->doAfter); - if (!call || !action) - { + if (!call || !action) { ERROR_LOG(HLE, "Failed to access deferred info for thread: %s", this->nt.name); return NULL; } diff --git a/GPU/GPU.vcxproj b/GPU/GPU.vcxproj index 323703f8d9..ff183907ae 100644 --- a/GPU/GPU.vcxproj +++ b/GPU/GPU.vcxproj @@ -74,6 +74,7 @@ Fast true false + false true @@ -89,6 +90,7 @@ false true false + false true @@ -107,6 +109,7 @@ _MBCS;%(PreprocessorDefinitions);_CRT_SECURE_NO_WARNINGS Speed true + false true @@ -127,6 +130,7 @@ Speed false true + false true diff --git a/UI/MenuScreens.cpp b/UI/MenuScreens.cpp index 52bd9f4093..75b4c8f7a9 100644 --- a/UI/MenuScreens.cpp +++ b/UI/MenuScreens.cpp @@ -310,15 +310,15 @@ void MenuScreen::render() { UIEnd(); // To try some new UI, enable this. - //screenManager()->switchScreen(new GameScreen(g_Config.recentIsos[i])); - screenManager()->switchScreen(new EmuScreen(g_Config.recentIsos[i])); + screenManager()->switchScreen(new GameScreen(g_Config.recentIsos[i])); + //screenManager()->switchScreen(new EmuScreen(g_Config.recentIsos[i])); return; } } else { if (UIButton((int)GEN_ID_LOOP(i), vgrid_recent, textureButtonWidth, textureButtonHeight, filename.c_str(), ALIGN_LEFT)) { UIEnd(); - //screenManager()->switchScreen(new GameScreen(g_Config.recentIsos[i])); - screenManager()->switchScreen(new EmuScreen(g_Config.recentIsos[i])); + screenManager()->switchScreen(new GameScreen(g_Config.recentIsos[i])); + //screenManager()->switchScreen(new EmuScreen(g_Config.recentIsos[i])); return; } } diff --git a/UI/UI.vcxproj b/UI/UI.vcxproj index 18903087c6..4ae459485e 100644 --- a/UI/UI.vcxproj +++ b/UI/UI.vcxproj @@ -102,6 +102,7 @@ ../common;..;../native;../native/ext/glew;../ext/zlib true false + false Windows @@ -118,6 +119,7 @@ ../common;..;../native;../native/ext/glew;../ext/zlib true false + false Windows @@ -137,6 +139,7 @@ false Speed true + false Windows @@ -157,6 +160,7 @@ ../common;..;../native;../native/ext/glew;../ext/zlib false true + false Windows diff --git a/Windows/PPSSPP.vcxproj b/Windows/PPSSPP.vcxproj index a0dfd2a026..4cf50f9be7 100644 --- a/Windows/PPSSPP.vcxproj +++ b/Windows/PPSSPP.vcxproj @@ -114,6 +114,7 @@ StreamingSIMDExtensions2 Fast true + false XInput.lib;Winmm.lib;Ws2_32.lib;opengl32.lib;..\ffmpeg\Windows\x86\lib\avcodec.lib;..\ffmpeg\Windows\x86\lib\avdevice.lib;..\ffmpeg\Windows\x86\lib\avformat.lib;..\ffmpeg\Windows\x86\lib\avutil.lib;..\ffmpeg\Windows\x86\lib\swresample.lib;..\ffmpeg\Windows\x86\lib\swscale.lib;glu32.lib;comctl32.lib;dsound.lib;xinput.lib;%(AdditionalDependencies) @@ -146,6 +147,7 @@ StreamingSIMDExtensions2 Fast true + false XInput.lib;Winmm.lib;Ws2_32.lib;opengl32.lib;dsound.lib;glu32.lib;..\ffmpeg\Windows\x86_64\lib\avcodec.lib;..\ffmpeg\Windows\x86_64\lib\avdevice.lib;..\ffmpeg\Windows\x86_64\lib\avformat.lib;..\ffmpeg\Windows\x86_64\lib\avutil.lib;..\ffmpeg\Windows\x86_64\lib\swresample.lib;..\ffmpeg\Windows\x86_64\lib\swscale.lib;comctl32.lib;%(AdditionalDependencies) @@ -179,6 +181,7 @@ stdafx.h stdafx.h true + false XInput.lib;Winmm.lib;Ws2_32.lib;opengl32.lib;..\ffmpeg\Windows\x86\lib\avcodec.lib;..\ffmpeg\Windows\x86\lib\avdevice.lib;..\ffmpeg\Windows\x86\lib\avformat.lib;..\ffmpeg\Windows\x86\lib\avutil.lib;..\ffmpeg\Windows\x86\lib\swresample.lib;..\ffmpeg\Windows\x86\lib\swscale.lib;dsound.lib;glu32.lib;comctl32.lib;%(AdditionalDependencies) @@ -219,6 +222,7 @@ ../common;..;../native;../native/ext/glew;../ext/zlib stdafx.h true + false XInput.lib;Winmm.lib;Ws2_32.lib;opengl32.lib;dsound.lib;glu32.lib;..\ffmpeg\Windows\x86_64\lib\avcodec.lib;..\ffmpeg\Windows\x86_64\lib\avdevice.lib;..\ffmpeg\Windows\x86_64\lib\avformat.lib;..\ffmpeg\Windows\x86_64\lib\avutil.lib;..\ffmpeg\Windows\x86_64\lib\swresample.lib;..\ffmpeg\Windows\x86_64\lib\swscale.lib;comctl32.lib;%(AdditionalDependencies) diff --git a/android/jni/Android.mk b/android/jni/Android.mk index fba0a47314..6f869f79b9 100644 --- a/android/jni/Android.mk +++ b/android/jni/Android.mk @@ -7,7 +7,7 @@ include $(CLEAR_VARS) LOCAL_MODULE := native_audio LOCAL_CFLAGS := -O2 -fsigned-char -ffast-math -Wall -Wno-multichar -Wno-psabi # yes, it's really CPPFLAGS for C++ -LOCAL_CPPFLAGS := -std=gnu++11 -frtti +LOCAL_CPPFLAGS := -std=gnu++11 -fno-rtti NATIVE := ../../native LOCAL_SRC_FILES := \ $(NATIVE)/android/native-audio-so.cpp @@ -28,7 +28,7 @@ SRC := ../.. LOCAL_CFLAGS := -DUSE_FFMPEG -DUSE_PROFILER -DGL_GLEXT_PROTOTYPES -DUSING_GLES2 -O2 -fsigned-char -Wall -Wno-multichar -Wno-psabi -Wno-unused-variable -fno-strict-aliasing -ffast-math # yes, it's really CPPFLAGS for C++ -LOCAL_CPPFLAGS := -std=gnu++11 -frtti +LOCAL_CPPFLAGS := -std=gnu++11 -fno-rtti LOCAL_C_INCLUDES := \ $(LOCAL_PATH)/../../Common \ $(LOCAL_PATH)/../.. \ diff --git a/android/jni/Application.mk b/android/jni/Application.mk index b3f083fb93..c274143fdd 100644 --- a/android/jni/Application.mk +++ b/android/jni/Application.mk @@ -1,4 +1,4 @@ APP_STL := gnustl_static APP_ABI := armeabi-v7a armeabi #APP_ABI := armeabi-v7a -APP_GNUSTL_CPP_FEATURES := rtti \ No newline at end of file +APP_GNUSTL_CPP_FEATURES := \ No newline at end of file diff --git a/ext/libkirk/libkirk.vcxproj b/ext/libkirk/libkirk.vcxproj index e7514705c5..75268c2a26 100644 --- a/ext/libkirk/libkirk.vcxproj +++ b/ext/libkirk/libkirk.vcxproj @@ -74,6 +74,7 @@ _MBCS;%(PreprocessorDefinitions);_CRT_SECURE_NO_WARNINGS true false + false true @@ -85,6 +86,7 @@ Disabled true false + false true @@ -102,6 +104,7 @@ _MBCS;%(PreprocessorDefinitions);_CRT_SECURE_NO_WARNINGS Speed true + false true @@ -117,6 +120,7 @@ true false true + false true diff --git a/ext/zlib/zlib.vcxproj b/ext/zlib/zlib.vcxproj index 73e7a4eaa7..f1b99505d1 100644 --- a/ext/zlib/zlib.vcxproj +++ b/ext/zlib/zlib.vcxproj @@ -109,6 +109,7 @@ ProgramDatabase true false + false Windows @@ -131,6 +132,7 @@ Default true false + false Windows @@ -152,6 +154,7 @@ Speed AnySuitable true + false Windows @@ -176,6 +179,7 @@ StreamingSIMDExtensions2 Fast true + false Windows diff --git a/headless/Headless.vcxproj b/headless/Headless.vcxproj index d91b3a6379..dd505e6263 100644 --- a/headless/Headless.vcxproj +++ b/headless/Headless.vcxproj @@ -87,6 +87,7 @@ Fast true false + false Console @@ -109,6 +110,7 @@ false true false + false Console @@ -133,6 +135,7 @@ Fast Speed true + false Console @@ -160,6 +163,7 @@ Speed false true + false Console diff --git a/native b/native index 976ef3b714..1d609c9b08 160000 --- a/native +++ b/native @@ -1 +1 @@ -Subproject commit 976ef3b7140cb14ef2cdaba59a12d767abd37483 +Subproject commit 1d609c9b0868245f844ad98e026f61fb54c63c5d diff --git a/unittest/UnitTests.vcxproj b/unittest/UnitTests.vcxproj index 1ef2ccc326..d218ac7f59 100644 --- a/unittest/UnitTests.vcxproj +++ b/unittest/UnitTests.vcxproj @@ -89,6 +89,7 @@ ../common;..;../native;../native/ext/glew;../ext/zlib true false + false Console @@ -106,6 +107,7 @@ ../common;..;../native;../native/ext/glew;../ext/zlib true false + false Console @@ -126,6 +128,7 @@ false Speed true + false Console @@ -147,6 +150,7 @@ ../common;..;../native;../native/ext/glew;../ext/zlib false true + false Console