From 0299ab7660f8bc22d1019a3b3627b28c2d4f78fb Mon Sep 17 00:00:00 2001 From: Sacha Date: Wed, 9 Jul 2014 06:33:57 +1000 Subject: [PATCH 1/6] wxRemoval: Ini.cpp --- rpcs3/Ini.cpp | 120 ++++++++++++++------------------------------------ 1 file changed, 33 insertions(+), 87 deletions(-) diff --git a/rpcs3/Ini.cpp b/rpcs3/Ini.cpp index 6dbfa06ec4..cf85609394 100644 --- a/rpcs3/Ini.cpp +++ b/rpcs3/Ini.cpp @@ -5,6 +5,7 @@ #include #include +#include #define DEF_CONFIG_NAME "./rpcs3.ini" @@ -27,28 +28,18 @@ void saveIniFile() } std::pair rDefaultSize = { -1, -1 }; +std::pair rDefaultPosition = { -1, -1 }; Inis Ini; -static bool StringToBool(const wxString& str) +static bool StringToBool(const std::string& str) { - if ( - !str.CmpNoCase("enable") || - !str.CmpNoCase("e") || - !str.CmpNoCase("1") || - !str.CmpNoCase("true") || - !str.CmpNoCase("t")) - { - return true; - } - - return false; + return std::regex_match(str.begin(), str.end(), + std::regex("1|e|t|enable|true", std::regex_constants::icase)); } -static wxString BoolToString(const bool b) +static inline std::string BoolToString(const bool b) { - if (b) return "true"; - - return "false"; + return b ? "true" : "false"; } //takes a string of format "[number]x[number]" and returns a pair of ints @@ -56,37 +47,21 @@ static wxString BoolToString(const bool b) static std::pair StringToSize(const std::string& str) { std::pair ret; + std::sregex_token_iterator first(str.begin(), str.end(), std::regex("x"), -1), last; + std::vector vec(first, last); + if (vec.size() < 2) + return rDefaultSize; - std::string s[2] = { "", "" }; - - for (uint i = 0, a = 0; i= 2) return rDefaultSize; - continue; - } - - s[a] += str.substr(i, 1); + try { + ret.first = std::stoi(vec.at(0)); + ret.second = std::stoi(vec.at(1)); } - - if (s[0].empty() || s[1].empty()) - { + catch (const std::invalid_argument& e) { return rDefaultSize; } - try{ - ret.first = std::stoi(s[0]); - ret.first = std::stoi(s[1]); - } - catch (const std::invalid_argument &e) - { - return rDefaultSize; - } if (ret.first < 0 || ret.second < 0) - { return rDefaultSize; - } return ret; } @@ -96,35 +71,19 @@ static std::string SizeToString(const std::pair& size) return fmt::Format("%dx%d", size.first, size.second); } -static wxPoint StringToPosition(const wxString& str) +static std::pair StringToPosition(const std::string& str) { - wxPoint ret; + std::pair ret; + std::sregex_token_iterator first(str.begin(), str.end(), std::regex("x"), -1), last; + std::vector vec(first, last); + if (vec.size() < 2) + return rDefaultPosition; - wxString s[2] = { wxEmptyString, wxEmptyString }; + ret.first = std::strtol(vec.at(0).c_str(), nullptr, 10); + ret.second = std::strtol(vec.at(1).c_str(), nullptr, 10); - for (uint i = 0, a = 0; i= 2) return wxDefaultPosition; - continue; - } - - s[a] += str(i, 1); - } - - if (s[0].IsEmpty() || s[1].IsEmpty()) - { - return wxDefaultPosition; - } - - s[0].ToLong((long*)&ret.x); - s[1].ToLong((long*)&ret.y); - - if (ret.x <= 0 || ret.y <= 0) - { - return wxDefaultPosition; - } + if (ret.first <= 0 || ret.second <= 0) + return rDefaultPosition; return ret; } @@ -133,29 +92,16 @@ static WindowInfo StringToWindowInfo(const std::string& str) { WindowInfo ret = WindowInfo(rDefaultSize, rDefaultSize); - std::string s[4] = { "", "", "", "" }; - - for (uint i = 0, a = 0; i= 4) return WindowInfo::GetDefault(); - continue; - } - - s[a] += str.substr(i, 1); - } - - if (s[0].empty() || s[1].empty() || s[2].empty() || s[3].empty()) - { + std::sregex_token_iterator first(str.begin(), str.end(), std::regex("x|:"), -1), last; + std::vector vec(first, last); + if (vec.size() < 4) return WindowInfo::GetDefault(); - } try{ - ret.size.first = std::stoi(s[0]); - ret.size.second = std::stoi(s[1]); - ret.position.first = std::stoi(s[2]); - ret.position.second = std::stoi(s[3]); + ret.size.first = std::stoi(vec.at(0)); + ret.size.second = std::stoi(vec.at(1)); + ret.position.first = std::stoi(vec.at(2)); + ret.position.second = std::stoi(vec.at(3)); } catch (const std::invalid_argument &e) { @@ -246,4 +192,4 @@ WindowInfo Ini::Load(const std::string& section, const std::string& key, const W { return StringToWindowInfo(m_Config->GetValue(section.c_str(), key.c_str(), WindowInfoToString(def_value).c_str())); saveIniFile(); -} \ No newline at end of file +} From dd382b2afc941f0bdc9f2c1239f19c52a7d4bdb5 Mon Sep 17 00:00:00 2001 From: Peter Tissen Date: Fri, 4 Jul 2014 10:29:31 +0200 Subject: [PATCH 2/6] add files to allow for packaging on teamcity add initial appveyor script add submodule update before build add msbuild cmd remove msbuild cmd make script runnable locally add solution without wxwdigets add initial appveyor script add submodule update before build add msbuild cmd remove msbuild cmd add packaging step to appveyor add ftp upload test use msbuild explicitly doesn't seem to work otherwise temporarily remove deploy script temporarily remove build script remove non-essential stuff add back some stuff set artifact path update artifact stuff try to add back deploy add build step again, *sigh* add some more build settings add build sript style build again download wxwidgets instead of building remove quite flag for debugging add cert igonre to download dont redundantly add folder use a seperate solution without wxwidgets dependencies only use the rpcs3 7z as artifact to avoid re-packaging wxwidgets, also comment out deployment, since I don't have acccess to the main account to add secure strings Conflicts: package.bat --- appveyor.yml | 56 ++++++++++++++++++++++++++++++++++++++++++++++ package.bat | 8 +++---- rpcs3_buildbot.sln | 54 ++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 114 insertions(+), 4 deletions(-) create mode 100644 appveyor.yml create mode 100644 rpcs3_buildbot.sln diff --git a/appveyor.yml b/appveyor.yml new file mode 100644 index 0000000000..9ebfa5fbe6 --- /dev/null +++ b/appveyor.yml @@ -0,0 +1,56 @@ + + +# version format +version: 0.1.{build} + +branches: + only: + - appveyorbuild + # blacklist + #except: + # - gh-pages + +#---------------------------------# +# environment configuration # +#---------------------------------# + +# clone directory +clone_folder: c:\projects\rpcs3 + +platform: + - x64 + +configuration: + - Release + +install: + - cmd: cinst wget -x86 + - cmd: cinst 7zip.commandline -x86 + - cmd: git submodule update --init --recursive .\ffmpeg .\asmjit + - cmd: wget -q --no-check-certificate https://googledrive.com/host/0B3tDmChwjRbRTTdhaTFOeGN1eEU/wxWidgets.7z -O c:\projects\rpcs3\wxwidgets.7z + - cmd: 7z x C:\projects\rpcs3\wxwidgets.7z -oc:\projects\rpcs3\wxWidgets + +build: + +build_script: + - msbuild /m /p:Configuration=Release rpcs3_buildbot.sln + +after_build: + - cmd: package.bat + +artifacts: + - path: .\rpcs3*.7z + +deploy: OFF +# - provider: FTP +# server: +# secure: kZT7rsbEPGQ0fC2GFRBGfL2vPwUgih2JkwjbSuw00T8= +# username: +# secure: YJzwsi4wfSezFLqaB9uiww== +# password: +# secure: EQ3xa2LoRgelAdE57+qakQ== +# folder: .\rpcs3\ +# enable_ssl: false + +test: OFF + diff --git a/package.bat b/package.bat index 8d6fe2cbe6..1bff43a141 100644 --- a/package.bat +++ b/package.bat @@ -5,16 +5,16 @@ copy bin\soft-oal.dll build\rpcs3 copy bin\make_fself.cmd build\rpcs3 mkdir build\rpcs3\dev_hdd1 -xcopy /Y /e bin\dev_hdd1 build\rpcs3\dev_hdd1 +xcopy /e bin\dev_hdd1 build\rpcs3\dev_hdd1 mkdir build\rpcs3\dev_hdd0 -xcopy /Y /e bin\dev_hdd0 build\rpcs3\dev_hdd0 +xcopy /e bin\dev_hdd0 build\rpcs3\dev_hdd0 mkdir build\rpcs3\dev_flash -xcopy /Y /e bin\dev_flash build\rpcs3\dev_flash +xcopy /e bin\dev_flash build\rpcs3\dev_flash mkdir build\rpcs3\dev_usb000 -xcopy /Y /e bin\dev_usb000 build\rpcs3\dev_usb000 +xcopy /e bin\dev_usb000 build\rpcs3\dev_usb000 for /f "delims=" %%a in ('git describe') do @set gitrev=%%a diff --git a/rpcs3_buildbot.sln b/rpcs3_buildbot.sln new file mode 100644 index 0000000000..2945457917 --- /dev/null +++ b/rpcs3_buildbot.sln @@ -0,0 +1,54 @@ +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Express 2013 for Windows Desktop +VisualStudioVersion = 12.0.30501.0 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "rpcs3", "rpcs3\rpcs3.vcxproj", "{70CD65B0-91D6-4FAE-9A7B-4AF55D0D1B12}" + ProjectSection(ProjectDependencies) = postProject + {AC40FF01-426E-4838-A317-66354CEFAE88} = {AC40FF01-426E-4838-A317-66354CEFAE88} + {C4A10229-4712-4BD2-B63E-50D93C67A038} = {C4A10229-4712-4BD2-B63E-50D93C67A038} + EndProjectSection +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "stblib", "stblib", "{9D839DFB-76E6-4F10-8EED-BA2AC7CC3FB6}" + ProjectSection(SolutionItems) = preProject + stblib\stb_image.c = stblib\stb_image.c + stblib\stb_image.h = stblib\stb_image.h + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "asmjit", "asmjitsrc\asmjit.vcxproj", "{AC40FF01-426E-4838-A317-66354CEFAE88}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "asmjit", "asmjit", "{E2A982F2-4B1A-48B1-8D77-A17A589C58D7}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "emucore", "rpcs3\emucore.vcxproj", "{C4A10229-4712-4BD2-B63E-50D93C67A038}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug - MemLeak|x64 = Debug - MemLeak|x64 + Debug|x64 = Debug|x64 + Release|x64 = Release|x64 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {70CD65B0-91D6-4FAE-9A7B-4AF55D0D1B12}.Debug - MemLeak|x64.ActiveCfg = Debug - MemLeak|x64 + {70CD65B0-91D6-4FAE-9A7B-4AF55D0D1B12}.Debug - MemLeak|x64.Build.0 = Debug - MemLeak|x64 + {70CD65B0-91D6-4FAE-9A7B-4AF55D0D1B12}.Debug|x64.ActiveCfg = Debug|x64 + {70CD65B0-91D6-4FAE-9A7B-4AF55D0D1B12}.Debug|x64.Build.0 = Debug|x64 + {70CD65B0-91D6-4FAE-9A7B-4AF55D0D1B12}.Release|x64.ActiveCfg = Release|x64 + {70CD65B0-91D6-4FAE-9A7B-4AF55D0D1B12}.Release|x64.Build.0 = Release|x64 + {AC40FF01-426E-4838-A317-66354CEFAE88}.Debug - MemLeak|x64.ActiveCfg = Debug|x64 + {AC40FF01-426E-4838-A317-66354CEFAE88}.Debug|x64.ActiveCfg = Debug|x64 + {AC40FF01-426E-4838-A317-66354CEFAE88}.Debug|x64.Build.0 = Debug|x64 + {AC40FF01-426E-4838-A317-66354CEFAE88}.Release|x64.ActiveCfg = Release|x64 + {AC40FF01-426E-4838-A317-66354CEFAE88}.Release|x64.Build.0 = Release|x64 + {C4A10229-4712-4BD2-B63E-50D93C67A038}.Debug - MemLeak|x64.ActiveCfg = Debug - MemLeak|x64 + {C4A10229-4712-4BD2-B63E-50D93C67A038}.Debug - MemLeak|x64.Build.0 = Debug - MemLeak|x64 + {C4A10229-4712-4BD2-B63E-50D93C67A038}.Debug|x64.ActiveCfg = Debug|x64 + {C4A10229-4712-4BD2-B63E-50D93C67A038}.Debug|x64.Build.0 = Debug|x64 + {C4A10229-4712-4BD2-B63E-50D93C67A038}.Release|x64.ActiveCfg = Release|x64 + {C4A10229-4712-4BD2-B63E-50D93C67A038}.Release|x64.Build.0 = Release|x64 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(NestedProjects) = preSolution + {AC40FF01-426E-4838-A317-66354CEFAE88} = {E2A982F2-4B1A-48B1-8D77-A17A589C58D7} + EndGlobalSection +EndGlobal From 10d9c3e4126fb270232845d9087abf601c133199 Mon Sep 17 00:00:00 2001 From: Peter Tissen Date: Wed, 9 Jul 2014 17:27:20 +0200 Subject: [PATCH 3/6] add back /Y flag on xcopy to make sure no stdin input is requuired --- package.bat | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/package.bat b/package.bat index 1bff43a141..8d6fe2cbe6 100644 --- a/package.bat +++ b/package.bat @@ -5,16 +5,16 @@ copy bin\soft-oal.dll build\rpcs3 copy bin\make_fself.cmd build\rpcs3 mkdir build\rpcs3\dev_hdd1 -xcopy /e bin\dev_hdd1 build\rpcs3\dev_hdd1 +xcopy /Y /e bin\dev_hdd1 build\rpcs3\dev_hdd1 mkdir build\rpcs3\dev_hdd0 -xcopy /e bin\dev_hdd0 build\rpcs3\dev_hdd0 +xcopy /Y /e bin\dev_hdd0 build\rpcs3\dev_hdd0 mkdir build\rpcs3\dev_flash -xcopy /e bin\dev_flash build\rpcs3\dev_flash +xcopy /Y /e bin\dev_flash build\rpcs3\dev_flash mkdir build\rpcs3\dev_usb000 -xcopy /e bin\dev_usb000 build\rpcs3\dev_usb000 +xcopy /Y /e bin\dev_usb000 build\rpcs3\dev_usb000 for /f "delims=" %%a in ('git describe') do @set gitrev=%%a From 711f9eadc5c15d40243a8f83fc7aaf4ef5407f12 Mon Sep 17 00:00:00 2001 From: Sacha Date: Thu, 10 Jul 2014 05:16:17 +1000 Subject: [PATCH 4/6] Revert some changes until GCC 4.9 is available. --- .travis.yml | 7 +++++-- rpcs3/Ini.cpp | 58 ++++++++++++++++++++++++++++++++++++++++++--------- 2 files changed, 53 insertions(+), 12 deletions(-) diff --git a/.travis.yml b/.travis.yml index bdf0fec902..4866b49c1d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -8,6 +8,9 @@ branches: only: - master +git: + submodules: false + before_install: - echo "yes" | sudo apt-key adv --fetch-keys http://repos.codelite.org/CodeLite.asc - echo "yes" | sudo apt-add-repository 'deb http://repos.codelite.org/wx3.0/ubuntu/ precise universe' @@ -25,11 +28,11 @@ before_install: sudo ./cmake-2.8.12.1-Linux-i386.sh --skip-license --prefix=/usr; before_script: - - git submodule update --init --recursive + - git submodule update --init asmjit ffmpeg - mkdir build - cd build - cmake .. script: - - make + - make -j 4 diff --git a/rpcs3/Ini.cpp b/rpcs3/Ini.cpp index cf85609394..ac0086f543 100644 --- a/rpcs3/Ini.cpp +++ b/rpcs3/Ini.cpp @@ -47,14 +47,33 @@ static inline std::string BoolToString(const bool b) static std::pair StringToSize(const std::string& str) { std::pair ret; + +#if 1 + std::string s[2] = { "", "" }; + + for (uint i = 0, a = 0; i= 2) return rDefaultSize; + continue; + } + + s[a] += str.substr(i, 1); + } + + if (s[0].empty() || s[1].empty()) +#else + // Requires GCC 4.9 or new stdlib for Clang std::sregex_token_iterator first(str.begin(), str.end(), std::regex("x"), -1), last; - std::vector vec(first, last); + std::vector s(first, last); if (vec.size() < 2) +#endif return rDefaultSize; try { - ret.first = std::stoi(vec.at(0)); - ret.second = std::stoi(vec.at(1)); + ret.first = std::stoi(s[0]); + ret.second = std::stoi(s[1]); } catch (const std::invalid_argument& e) { return rDefaultSize; @@ -71,7 +90,8 @@ static std::string SizeToString(const std::pair& size) return fmt::Format("%dx%d", size.first, size.second); } -static std::pair StringToPosition(const std::string& str) +// Unused? +/*static std::pair StringToPosition(const std::string& str) { std::pair ret; std::sregex_token_iterator first(str.begin(), str.end(), std::regex("x"), -1), last; @@ -86,22 +106,40 @@ static std::pair StringToPosition(const std::string& str) return rDefaultPosition; return ret; -} +}*/ static WindowInfo StringToWindowInfo(const std::string& str) { WindowInfo ret = WindowInfo(rDefaultSize, rDefaultSize); +#if 1 + std::string s[4] = { "", "", "", "" }; + + for (uint i = 0, a = 0; i= 4) return WindowInfo::GetDefault(); + continue; + } + + s[a] += str.substr(i, 1); + } + + if (s[0].empty() || s[1].empty() || s[2].empty() || s[3].empty()) +#else + // Requires GCC 4.9 or new stdlib for Clang std::sregex_token_iterator first(str.begin(), str.end(), std::regex("x|:"), -1), last; - std::vector vec(first, last); + std::vector s(first, last); if (vec.size() < 4) +#endif return WindowInfo::GetDefault(); try{ - ret.size.first = std::stoi(vec.at(0)); - ret.size.second = std::stoi(vec.at(1)); - ret.position.first = std::stoi(vec.at(2)); - ret.position.second = std::stoi(vec.at(3)); + ret.size.first = std::stoi(s[0]); + ret.size.second = std::stoi(s[1]); + ret.position.first = std::stoi(s[2]); + ret.position.second = std::stoi(s[3]); } catch (const std::invalid_argument &e) { From 80dbe1a67f4c663b64475cdbe3fe0e57699aa4e0 Mon Sep 17 00:00:00 2001 From: Sacha Date: Thu, 10 Jul 2014 06:49:24 +1000 Subject: [PATCH 5/6] Use an alternative to sregex. --- rpcs3/Ini.cpp | 118 ++++++++++++-------------------------------------- 1 file changed, 27 insertions(+), 91 deletions(-) diff --git a/rpcs3/Ini.cpp b/rpcs3/Ini.cpp index ac0086f543..008be9c59d 100644 --- a/rpcs3/Ini.cpp +++ b/rpcs3/Ini.cpp @@ -27,8 +27,6 @@ void saveIniFile() getIniFile()->SaveFile(DEF_CONFIG_NAME); } -std::pair rDefaultSize = { -1, -1 }; -std::pair rDefaultPosition = { -1, -1 }; Inis Ini; static bool StringToBool(const std::string& str) @@ -46,43 +44,23 @@ static inline std::string BoolToString(const bool b) //example input would be "123x456" and the returned value would be {123,456} static std::pair StringToSize(const std::string& str) { - std::pair ret; - -#if 1 - std::string s[2] = { "", "" }; - - for (uint i = 0, a = 0; i= 2) return rDefaultSize; - continue; + std::size_t start = 0, found; + std::vector vec; + for (int i = 0; i < 2 && (found = str.find_first_of('x', start)); i++) { + try { + vec.push_back(std::stoi(str.substr(start, found == std::string::npos ? found : found - start))); } - - s[a] += str.substr(i, 1); + catch (const std::invalid_argument& e) { + return std::make_pair(-1, -1); + } + if (found == std::string::npos) + break; + start = found + 1; } + if (vec.size() < 2 || vec[0] < 0 || vec[1] < 0) + return std::make_pair(-1, -1); - if (s[0].empty() || s[1].empty()) -#else - // Requires GCC 4.9 or new stdlib for Clang - std::sregex_token_iterator first(str.begin(), str.end(), std::regex("x"), -1), last; - std::vector s(first, last); - if (vec.size() < 2) -#endif - return rDefaultSize; - - try { - ret.first = std::stoi(s[0]); - ret.second = std::stoi(s[1]); - } - catch (const std::invalid_argument& e) { - return rDefaultSize; - } - - if (ret.first < 0 || ret.second < 0) - return rDefaultSize; - - return ret; + return std::make_pair(vec[0], vec[1]); } static std::string SizeToString(const std::pair& size) @@ -90,67 +68,25 @@ static std::string SizeToString(const std::pair& size) return fmt::Format("%dx%d", size.first, size.second); } -// Unused? -/*static std::pair StringToPosition(const std::string& str) -{ - std::pair ret; - std::sregex_token_iterator first(str.begin(), str.end(), std::regex("x"), -1), last; - std::vector vec(first, last); - if (vec.size() < 2) - return rDefaultPosition; - - ret.first = std::strtol(vec.at(0).c_str(), nullptr, 10); - ret.second = std::strtol(vec.at(1).c_str(), nullptr, 10); - - if (ret.first <= 0 || ret.second <= 0) - return rDefaultPosition; - - return ret; -}*/ - static WindowInfo StringToWindowInfo(const std::string& str) { - WindowInfo ret = WindowInfo(rDefaultSize, rDefaultSize); - -#if 1 - std::string s[4] = { "", "", "", "" }; - - for (uint i = 0, a = 0; i= 4) return WindowInfo::GetDefault(); - continue; + std::size_t start = 0, found; + std::vector vec; + for (int i = 0; i < 4 && (found = str.find_first_of("x:", start)); i++) { + try { + vec.push_back(std::stoi(str.substr(start, found == std::string::npos ? found : found - start))); } - - s[a] += str.substr(i, 1); + catch (const std::invalid_argument& e) { + return WindowInfo::GetDefault(); + } + if (found == std::string::npos) + break; + start = found + 1; } - - if (s[0].empty() || s[1].empty() || s[2].empty() || s[3].empty()) -#else - // Requires GCC 4.9 or new stdlib for Clang - std::sregex_token_iterator first(str.begin(), str.end(), std::regex("x|:"), -1), last; - std::vector s(first, last); - if (vec.size() < 4) -#endif + if (vec.size() < 4 || vec[0] <= 0 || vec[1] <= 0 || vec[2] < 0 || vec[3] < 0) return WindowInfo::GetDefault(); - try{ - ret.size.first = std::stoi(s[0]); - ret.size.second = std::stoi(s[1]); - ret.position.first = std::stoi(s[2]); - ret.position.second = std::stoi(s[3]); - } - catch (const std::invalid_argument &e) - { - return WindowInfo::GetDefault(); - } - if (ret.size.first <= 0 || ret.size.second <= 0) - { - return WindowInfo::GetDefault(); - } - - return ret; + return WindowInfo(std::make_pair(vec[0], vec[1]), std::make_pair(vec[2], vec[3])); } static std::string WindowInfoToString(const WindowInfo& wind) From 96fb8b968fb8c065c4e9a96bfe7a439e009d1421 Mon Sep 17 00:00:00 2001 From: raven02 Date: Wed, 9 Jul 2014 23:46:58 +0800 Subject: [PATCH 6/6] Fix crash in Battle fantasia/Crystal defenders --- rpcs3/Emu/SysCalls/Modules/cellResc.cpp | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/rpcs3/Emu/SysCalls/Modules/cellResc.cpp b/rpcs3/Emu/SysCalls/Modules/cellResc.cpp index fdd633f28d..20c8e98c70 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellResc.cpp +++ b/rpcs3/Emu/SysCalls/Modules/cellResc.cpp @@ -1266,14 +1266,15 @@ static void blackman(float window[]) window[3] = ((100.f - SEVIRITY) / 100.f + SEVIRITY / 100.f*a3); } -int CreateInterlaceTable(mem32_t ea, float srcH, float dstH, CellRescTableElement depth, int length) +int CreateInterlaceTable(u32 ea_addr, float srcH, float dstH, CellRescTableElement depth, int length) { - float phi[4], transient[4], *buf32 = (float*)ea.GetAddr(); + float phi[4], transient[4]; float y_fraction; float bandwidth = 0.5f / (srcH / dstH); float phi_b = 2.f * M_PI * bandwidth; float window[4]; - u16 *buf16 = (u16*)ea.GetAddr(); + mem16_ptr_t buf16(ea_addr); + mem32_ptr_t buf32(ea_addr); blackman(window); @@ -1312,9 +1313,9 @@ int CreateInterlaceTable(mem32_t ea, float srcH, float dstH, CellRescTableElemen return CELL_OK; } -int cellRescCreateInterlaceTable(mem32_t ea, float srcH, CellRescTableElement depth, int length) +int cellRescCreateInterlaceTable(u32 ea_addr, float srcH, CellRescTableElement depth, int length) { - cellResc->Warning("cellRescCreateInterlaceTable(ea=0x%x, depth = %i, length = %i)", ea.GetAddr(), depth, length); + cellResc->Warning("cellRescCreateInterlaceTable(ea_addr=0x%x, depth = %i, length = %i)", ea_addr, depth, length); if (!s_rescInternalInstance->m_bInitialized) { @@ -1322,7 +1323,7 @@ int cellRescCreateInterlaceTable(mem32_t ea, float srcH, CellRescTableElement de return CELL_RESC_ERROR_NOT_INITIALIZED; } - if ((!ea.IsGood()) || (srcH <= 0.f) || (!(depth == CELL_RESC_ELEMENT_HALF || depth == CELL_RESC_ELEMENT_FLOAT)) || (length <= 0)) + if ((ea_addr == NULL) || (srcH <= 0.f) || (!(depth == CELL_RESC_ELEMENT_HALF || depth == CELL_RESC_ELEMENT_FLOAT)) || (length <= 0)) { cellResc->Error("cellRescCreateInterlaceTable : CELL_RESC_ERROR_NOT_INITIALIZED"); return CELL_RESC_ERROR_BAD_ARGUMENT; @@ -1337,9 +1338,9 @@ int cellRescCreateInterlaceTable(mem32_t ea, float srcH, CellRescTableElement de float ratioModeCoefficient = (s_rescInternalInstance->m_initConfig.ratioMode != CELL_RESC_LETTERBOX) ? 1.f : (1.f - 2.f * XY_DELTA_LB); float dstH = s_rescInternalInstance->m_dstHeight * ratioModeCoefficient * s_rescInternalInstance->m_ratioAdjY; - if (int retValue = CreateInterlaceTable(ea, srcH, dstH, depth, length) == CELL_OK) + if (int retValue = CreateInterlaceTable(ea_addr, srcH, dstH, depth, length) == CELL_OK) { - s_rescInternalInstance->m_interlaceTableEA = ea; + s_rescInternalInstance->m_interlaceTableEA = ea_addr; s_rescInternalInstance->m_interlaceElement = depth; s_rescInternalInstance->m_interlaceTableLength = length; return CELL_OK;