Skip to content

Commit

Permalink
v0.1.1 bugfix
Browse files Browse the repository at this point in the history
See CHANGELOG.md
  • Loading branch information
dragos240 committed Oct 31, 2016
1 parent 8e8ef76 commit 7243fd9
Show file tree
Hide file tree
Showing 7 changed files with 37 additions and 14 deletions.
14 changes: 14 additions & 0 deletions CHANGELOG.md
@@ -0,0 +1,14 @@
# Change Log

## [0.1.1] - 2016-10-31
### Added
- Support for EUR and JP copies of the game

### Changed
- Now auto-creates necessary folders (bugfix)

## [0.1.0] - 2016-10-30
### Added
- Autobackup of saves on app start
- Ability to launch games by selecting the save folder and pressing "Launch town"
- Ability to delete saved towns
8 changes: 4 additions & 4 deletions Makefile
Expand Up @@ -165,10 +165,10 @@ cia:
rm -f banner.bnr icon.icn

zip:
rm -rf TownManager-latest
mkdir TownManager-latest
cp $(TARGET).3dsx $(OUTPUT).smdh TownManager-latest
zip -r TownManager-latest.zip TownManager-latest/
rm -rf TownManager-latest.zip
mkdir TownManager
cp $(TARGET).3dsx $(TARGET).cia $(OUTPUT).smdh TownManager.xml TownManager
zip -r TownManager-latest.zip TownManager

#---------------------------------------------------------------------------------
else
Expand Down
4 changes: 3 additions & 1 deletion include/common.h
Expand Up @@ -3,7 +3,9 @@

#include <3ds.h>

#define GAMEID 0x0004000000086300
#define NA_GAMEID 0x0004000000086300
#define EU_GAMEID 0x0004000000086400
#define JP_GAMEID 0x0004000e00086200
#define SECOND_IN_NS (1000*1000*1000)
#define SIZE_GARDEN 522752
#define __FILENAME__ (strrchr(__FILE__, '/') ? strrchr(__FILE__, '/') + 1 : __FILE__)
Expand Down
2 changes: 2 additions & 0 deletions source/backup.c
Expand Up @@ -160,9 +160,11 @@ void backup_to_prev_folder(char* dirname){
int error;
int i;

FSUSER_CreateDirectory(sdmc_arch, fsMakePath(PATH_ASCII, savespath), 0);
//Erase sdmc data
sdmcpath = calloc(strlen(savespath)+strlen(dirname)+1+1, 1);
sprintf(sdmcpath, "%s%s/", savespath, dirname);
FSUSER_CreateDirectory(sdmc_arch, fsMakePath(PATH_ASCII, sdmcpath), 0);
files = get_files(sdmc_arch, sdmcpath);
if(files.numfiles != 0){
gfx_displaymessage("Erasing old files from the SD card...");
Expand Down
6 changes: 5 additions & 1 deletion source/fs.c
Expand Up @@ -35,7 +35,11 @@ Result fs_init(){
return ret;

amInit();
titleid = GAMEID;
AM_GetTitleList(NULL, MEDIATYPE_GAME_CARD, 1, &titleid);
if(titleid != NA_GAMEID && titleid != EU_GAMEID && titleid != JP_GAMEID){
gfx_waitmessage("Unknown titleID 0x%llX", titleid);
return -1;
}
lowerid = (u32)(titleid);
upperid = (u32)(titleid >> 32);
if(is3dsx){
Expand Down
16 changes: 8 additions & 8 deletions source/main.c
Expand Up @@ -34,25 +34,25 @@ int main(){
gfx_init();
launcher_init();
ret = fs_init();
if(ret)
if(ret){
gfx_error(ret, __FILENAME__, __LINE__);
goto main_cleanup;
}

load_tm_config(&current_town);
if(strcmp(current_town, "") != 0)
if(strcmp(current_town, "") != 0){
backup_to_prev_folder(current_town);
}

while(aptMainLoop() && menuindex != -1){
populate_menu_entries(&menu_entries, &menucount);
if(ret){
gfx_error(ret, __FILENAME__, __LINE__);
return 1;
}

if(menucount == 1){
init_save_folder();
}
else
else{
display_menu(menu_entries, menucount, &menuindex, headerstr);
}

if(menuindex != menucount-1 && menuindex != -1){
town_opts(menu_entries[menuindex]);
Expand All @@ -61,7 +61,7 @@ int main(){
create_town();
}
}

main_cleanup:
fs_fini();
launcher_fini();
gfx_fini();
Expand Down
1 change: 1 addition & 0 deletions source/town.c
Expand Up @@ -141,6 +141,7 @@ void load_tm_config(char** current){
int eol = 0;
char* buf2;

FSUSER_CreateDirectory(sdmc_arch, fsMakePath(PATH_ASCII, "/TownManager"), 0);
ret = FSUSER_OpenFile(&handle, sdmc_arch, fsMakePath(PATH_ASCII, "/TownManager/tm.conf"), FS_OPEN_READ | FS_OPEN_CREATE, 0);
if(ret){
gfx_error(ret, __FILENAME__, __LINE__);
Expand Down

0 comments on commit 7243fd9

Please sign in to comment.