commit e2c1aecd1bc22fcf93f9d65f8fecc6e9eee40996
Author: Jon Bell <j.to.the.bell@gmail.com>
AuthorDate: Thu Apr 8 21:20:55 2021 -0600
Commit: Jon Bell <j.to.the.bell@gmail.com>
CommitDate: Thu Apr 8 21:20:55 2021 -0600
WIP trying to get wii u cartdata working
---
platform/wiiu/source/WiiUHost.cpp | 26 ++++++++++++++++++++++++--
source/hostCommonFunctions.cpp | 4 ++--
2 files changed, 26 insertions(+), 4 deletions(-)
diff --git a/platform/wiiu/source/WiiUHost.cpp b/platform/wiiu/source/WiiUHost.cpp
index 6ae0cd7..5996ffb 100644
--- a/platform/wiiu/source/WiiUHost.cpp
+++ b/platform/wiiu/source/WiiUHost.cpp
@@ -138,7 +138,25 @@ void audioSetup(){
*/
}
-Host::Host() { }
+Host::Host() {
+ struct stat st = {0};
+
+ int res = chdir("fs:/vol/external01");
+ if (res == 0 && stat("wiiu", &st) == -1) {
+ res = mkdir("wiiu", 0777);
+ }
+ if (res == 0 && stat("wiiu/apps", &st) == -1) {
+ res = mkdir("wiiu/apps", 0777);
+ }
+ if (res == 0 && stat("wiiu/apps/fake08", &st) == -1) {
+ res = mkdir("wiiu/apps/fake08", 0777);
+ }
+ if (res == 0 && stat("wiiu/apps/fake08/cdata", &st) == -1) {
+ res = mkdir("wiiu/apps/fake08/cdata", 0777);
+ }
+
+ _logFilePrefix = "wiiu/apps/fake08/";
+ }
void Host::oneTimeSetup(Color* paletteColors, Audio* audio){
@@ -194,9 +212,13 @@ void Host::oneTimeSetup(Color* paletteColors, Audio* audio){
targetFrameTimeMs = 0;
_paletteColors = paletteColors;
+
+ loadSettingsIni();
}
void Host::oneTimeCleanup(){
+ saveSettingsIni();
+
audioCleanup();
SDL_DestroyTexture(texture);
@@ -389,7 +411,7 @@ vector<string> Host::listcarts(){
}
const char* Host::logFilePrefix() {
- return "";
+ return _logFilePrefix.c_str();
}
std::string Host::customBiosLua() {
diff --git a/source/hostCommonFunctions.cpp b/source/hostCommonFunctions.cpp
index 3f02139..d7241e2 100644
--- a/source/hostCommonFunctions.cpp
+++ b/source/hostCommonFunctions.cpp
@@ -10,7 +10,7 @@ using namespace std;
CSimpleIniA settingsIni;
void Host::loadSettingsIni(){
- std::string settingsIniStr = get_file_contents(_logFilePrefix + "/settings.ini");
+ std::string settingsIniStr = get_file_contents(_logFilePrefix + "settings.ini");
//File does not exist, fill string with defaults
if(settingsIniStr.length() == 0 ){
@@ -31,7 +31,7 @@ void Host::saveSettingsIni(){
std::string settingsIniStr = "";
settingsIni.Save(settingsIniStr, false);
- std::string iniPath = _logFilePrefix + "/settings.ini";
+ std::string iniPath = _logFilePrefix + "settings.ini";
FILE * file = freopen(iniPath.c_str(), "w", stderr);
if( file != NULL ) {