commit 22fe78d5b0a62190e9f040cc407d8a21dbdd7ca4
Author: DPS2004 <dpsophinos@gmail.com>
AuthorDate: Wed Mar 9 10:31:46 2022 -0500
Commit: DPS2004 <dpsophinos@gmail.com>
CommitDate: Mon Mar 28 09:08:22 2022 -0400
windows + 3ds platform fixes
---
platform/3ds/Makefile | 6 +++---
platform/3ds/source/3dsHost.cpp | 6 ++++++
source/hostCommonFunctions.cpp | 11 +++++++++--
source/main.cpp | 2 ++
4 files changed, 20 insertions(+), 5 deletions(-)
diff --git a/platform/3ds/Makefile b/platform/3ds/Makefile
index 7d8da2c..5435ef0 100644
--- a/platform/3ds/Makefile
+++ b/platform/3ds/Makefile
@@ -73,7 +73,7 @@ CFLAGS := -g -Wall -Ofast -mword-relocations \
CFLAGS += $(INCLUDE) -DARM11 -D_3DS -DVER_STR=\"$(APP_VERSION)\"
# enable pack in games with this platform
-# CFLAGS += -DLOAD_PACK_INS
+CFLAGS += -DLOAD_PACK_INS
CXXFLAGS := $(CFLAGS) -fno-rtti -fexceptions -std=gnu++17
@@ -215,8 +215,8 @@ $(GFXBUILD)/%.t3x $(BUILD)/%.h : %.t3s
$(TARGET)-strip.elf: $(BUILD)
@$(STRIP) $(TARGET).elf -o $(TARGET)-strip.elf
#---------------------------------------------------------------------------------
-$(TARGET)-cia.bnr: banner/$(TARGET)-banner.png banner/$(TARGET).wav
- @bannertool makebanner -i banner/$(TARGET)-banner.png -a banner/$(TARGET).wav -o $(TARGET)-cia.bnr
+$(TARGET)-cia.bnr: banner/$(TARGET).cgfx banner/$(TARGET).wav
+ @bannertool makebanner -ci banner/$(TARGET).cgfx -a banner/$(TARGET).wav -o $(TARGET)-cia.bnr
#---------------------------------------------------------------------------------
$(TARGET)-cia.smdh: banner/$(TARGET)-icon.png
@bannertool makesmdh -s "$(TARGET)" -l "$(APP_TITLE)" -p "$(APP_AUTHOR)" -i banner/$(TARGET)-icon.png -o $(TARGET)-cia.smdh -r regionfree
diff --git a/platform/3ds/source/3dsHost.cpp b/platform/3ds/source/3dsHost.cpp
index 8fd229c..9aa8350 100644
--- a/platform/3ds/source/3dsHost.cpp
+++ b/platform/3ds/source/3dsHost.cpp
@@ -287,6 +287,12 @@ Host::Host() {
if (res == 0 && stat(cartdatadir.c_str(), &st) == -1) {
res = mkdir(cartdatadir.c_str(), 0777);
}
+
+ string cartdir = "sdmc:" + _cartDirectory;
+ if (res == 0 && stat(cartdir.c_str(), &st) == -1) {
+ res = mkdir(cartdir.c_str(), 0777);
+ }
+
}
void Host::setPlatformParams(
diff --git a/source/hostCommonFunctions.cpp b/source/hostCommonFunctions.cpp
index 041514d..9bd1bd8 100644
--- a/source/hostCommonFunctions.cpp
+++ b/source/hostCommonFunctions.cpp
@@ -8,7 +8,9 @@
#include "miniz.h"
+#if LOAD_PACK_INS
#include "cartzip.h"
+#endif
using namespace std;
@@ -59,7 +61,10 @@ Color* Host::GetPaletteColors(){
}
void Host::unpackCarts(){
- Logger_Write("unzipping pack in carts to p8carts");
+
+ #if LOAD_PACK_INS
+
+ Logger_Write("unzipping pack in carts to p8carts\n");
//based on https://github.com/richgel999/miniz/issues/38
@@ -80,7 +85,7 @@ void Host::unpackCarts(){
mz_zip_reader_end(&zip_archive);
}
// Get root folder
- string base = _cartDirectory + "\\"; // path delim on end
+ string base = _cartDirectory; // path delim on end
// Get and print information about each file in the archive.
for (int i = 0; i < fileCount; i++)
@@ -89,6 +94,7 @@ void Host::unpackCarts(){
if (mz_zip_reader_is_file_a_directory(&zip_archive, i)) continue; // skip directories for now
string fileName = base + file_stat.m_filename; // make path relative
Logger_Write(fileName.c_str());
+ Logger_Write("\n");
string destFile = fileName; // make full dest path
mz_zip_reader_extract_to_file(&zip_archive, i, destFile.c_str(), 0);
@@ -97,6 +103,7 @@ void Host::unpackCarts(){
// Close the archive, freeing any resources it was using
mz_zip_reader_end(&zip_archive);
+ #endif
}
diff --git a/source/main.cpp b/source/main.cpp
index 26559ba..4dcebd0 100644
--- a/source/main.cpp
+++ b/source/main.cpp
@@ -31,8 +31,10 @@ int main(int argc, char* argv[])
host->setUpPaletteColors();
host->oneTimeSetup(audio);
+ #if LOAD_PACK_INS
//todo: make this only happen once, save if it has happened in settings.ini
host->unpackCarts();
+ #endif
Logger_Write("initialized Vm and host\n");