2010-09-24 23:22:01 +02:00
|
|
|
/****************************************************************************
|
|
|
|
* Copyright (C) 2010
|
|
|
|
* by Dimok
|
|
|
|
*
|
|
|
|
* This software is provided 'as-is', without any express or implied
|
|
|
|
* warranty. In no event will the authors be held liable for any
|
|
|
|
* damages arising from the use of this software.
|
|
|
|
*
|
|
|
|
* Permission is granted to anyone to use this software for any
|
|
|
|
* purpose, including commercial applications, and to alter it and
|
|
|
|
* redistribute it freely, subject to the following restrictions:
|
|
|
|
*
|
|
|
|
* 1. The origin of this software must not be misrepresented; you
|
|
|
|
* must not claim that you wrote the original software. If you use
|
|
|
|
* this software in a product, an acknowledgment in the product
|
|
|
|
* documentation would be appreciated but is not required.
|
|
|
|
*
|
|
|
|
* 2. Altered source versions must be plainly marked as such, and
|
|
|
|
* must not be misrepresented as being the original software.
|
|
|
|
*
|
|
|
|
* 3. This notice may not be removed or altered from any source
|
|
|
|
* distribution.
|
|
|
|
***************************************************************************/
|
|
|
|
#include <ogcsys.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <string.h>
|
|
|
|
|
2011-01-21 20:43:59 +01:00
|
|
|
#include "CSettings.h"
|
2010-09-24 23:22:01 +02:00
|
|
|
#include "CGameSettings.h"
|
2010-09-25 08:54:27 +02:00
|
|
|
#include "FileOperations/fileops.h"
|
2011-01-06 19:59:45 +01:00
|
|
|
#include "svnrev.h"
|
2010-09-24 23:22:01 +02:00
|
|
|
|
2011-07-26 00:28:22 +02:00
|
|
|
#define VALID_CONFIG_REV 1031
|
2010-09-24 23:22:01 +02:00
|
|
|
|
2011-01-06 19:59:45 +01:00
|
|
|
CGameSettings GameSettings;
|
2010-09-24 23:22:01 +02:00
|
|
|
|
|
|
|
CGameSettings::CGameSettings()
|
|
|
|
{
|
2011-12-20 22:41:00 +01:00
|
|
|
SetDefault(DefaultConfig);
|
2010-09-24 23:22:01 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
CGameSettings::~CGameSettings()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
GameCFG * CGameSettings::GetGameCFG(const char * id)
|
|
|
|
{
|
2011-07-26 00:28:22 +02:00
|
|
|
if(!id)
|
2011-12-20 22:41:00 +01:00
|
|
|
{
|
|
|
|
DefaultConfig.id[0] = '\0';
|
|
|
|
return &DefaultConfig;
|
|
|
|
}
|
2010-09-24 23:22:01 +02:00
|
|
|
|
2011-07-26 00:28:22 +02:00
|
|
|
for(u32 i = 0; i < GameList.size(); ++i)
|
|
|
|
{
|
|
|
|
if(strncasecmp(id, GameList[i].id, 6) == 0)
|
|
|
|
return &GameList[i];
|
|
|
|
}
|
2010-09-24 23:22:01 +02:00
|
|
|
|
2011-12-20 22:41:00 +01:00
|
|
|
memcpy(DefaultConfig.id, id, 6);
|
2011-01-21 21:59:49 +01:00
|
|
|
|
2011-12-20 22:41:00 +01:00
|
|
|
return &DefaultConfig;
|
2010-09-24 23:22:01 +02:00
|
|
|
}
|
|
|
|
|
2010-09-25 10:51:44 +02:00
|
|
|
bool CGameSettings::AddGame(const GameCFG & NewGame)
|
2010-09-24 23:22:01 +02:00
|
|
|
{
|
2011-07-26 00:28:22 +02:00
|
|
|
for(u32 i = 0; i < GameList.size(); ++i)
|
|
|
|
{
|
|
|
|
if(strncasecmp(NewGame.id, GameList[i].id, 6) == 0)
|
|
|
|
{
|
2011-12-20 22:41:00 +01:00
|
|
|
GameList[i] = NewGame;
|
2011-07-26 00:28:22 +02:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
GameList.push_back(NewGame);
|
|
|
|
|
|
|
|
return true;
|
2010-09-24 23:22:01 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
bool CGameSettings::RemoveAll()
|
|
|
|
{
|
2011-07-26 00:28:22 +02:00
|
|
|
GameList.clear();
|
|
|
|
std::vector<GameCFG>().swap(GameList);
|
2010-09-24 23:22:01 +02:00
|
|
|
|
2011-07-26 00:28:22 +02:00
|
|
|
return Save();
|
2010-09-24 23:22:01 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
bool CGameSettings::Remove(const char * id)
|
|
|
|
{
|
2011-07-26 00:28:22 +02:00
|
|
|
if(!id)
|
|
|
|
return false;
|
|
|
|
|
|
|
|
for(u32 i = 0; i < GameList.size(); ++i)
|
|
|
|
{
|
|
|
|
if(strncasecmp(id, GameList[i].id, 6) == 0)
|
|
|
|
{
|
|
|
|
GameList.erase(GameList.begin()+i);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return true;
|
2010-09-24 23:22:01 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
bool CGameSettings::Load(const char * path)
|
|
|
|
{
|
2011-07-26 00:28:22 +02:00
|
|
|
char filepath[300];
|
|
|
|
snprintf(filepath, sizeof(filepath), "%sGXGameSettings.cfg", path);
|
2010-09-24 23:22:01 +02:00
|
|
|
|
2011-07-26 00:28:22 +02:00
|
|
|
ConfigPath = filepath;
|
2010-09-24 23:22:01 +02:00
|
|
|
|
2011-07-26 00:28:22 +02:00
|
|
|
FILE *file = fopen(filepath, "r");
|
|
|
|
if (!file) return false;
|
2010-09-24 23:22:01 +02:00
|
|
|
|
2011-07-26 00:28:22 +02:00
|
|
|
if(!ValidVersion(file))
|
|
|
|
{
|
|
|
|
fclose(file);
|
|
|
|
return false;
|
|
|
|
}
|
2011-01-06 19:59:45 +01:00
|
|
|
|
2011-12-20 22:41:00 +01:00
|
|
|
const int lineSize = 20*1024;
|
|
|
|
|
|
|
|
char *line = new (std::nothrow) char[lineSize];
|
|
|
|
if(!line) {
|
|
|
|
fclose(file);
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
while (fgets(line, lineSize, file))
|
2011-07-26 00:28:22 +02:00
|
|
|
{
|
|
|
|
if (line[0] == '#')
|
|
|
|
continue;
|
2010-09-24 23:22:01 +02:00
|
|
|
|
2011-07-26 00:28:22 +02:00
|
|
|
this->ParseLine(line);
|
|
|
|
}
|
2011-12-20 22:41:00 +01:00
|
|
|
|
|
|
|
delete [] line;
|
|
|
|
|
2011-07-26 00:28:22 +02:00
|
|
|
fclose(file);
|
2010-09-24 23:22:01 +02:00
|
|
|
|
2011-07-26 00:28:22 +02:00
|
|
|
return true;
|
2010-09-24 23:22:01 +02:00
|
|
|
}
|
|
|
|
|
2011-01-06 19:59:45 +01:00
|
|
|
bool CGameSettings::ValidVersion(FILE * file)
|
|
|
|
{
|
2011-07-26 00:28:22 +02:00
|
|
|
if(!file) return false;
|
2011-01-06 19:59:45 +01:00
|
|
|
|
2011-07-26 00:28:22 +02:00
|
|
|
char line[255];
|
|
|
|
int revision = 0;
|
2011-01-06 19:59:45 +01:00
|
|
|
|
2011-07-26 00:28:22 +02:00
|
|
|
while (fgets(line, sizeof(line), file))
|
|
|
|
{
|
|
|
|
const char * ptr = strcasestr(line, "USB Loader GX R");
|
|
|
|
if(ptr)
|
|
|
|
{
|
|
|
|
ptr += strlen("USB Loader GX R");
|
|
|
|
revision = atoi(ptr);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2011-01-06 19:59:45 +01:00
|
|
|
|
2011-07-26 00:28:22 +02:00
|
|
|
rewind(file);
|
2011-01-06 19:59:45 +01:00
|
|
|
|
2011-07-26 00:28:22 +02:00
|
|
|
return revision >= VALID_CONFIG_REV;
|
2011-01-06 19:59:45 +01:00
|
|
|
}
|
|
|
|
|
2010-09-24 23:22:01 +02:00
|
|
|
bool CGameSettings::Save()
|
|
|
|
{
|
2011-07-26 00:28:22 +02:00
|
|
|
char filepath[300];
|
2012-05-06 12:59:58 +02:00
|
|
|
strlcpy(filepath, ConfigPath.c_str(), sizeof(filepath));
|
2011-07-26 00:28:22 +02:00
|
|
|
|
|
|
|
char * ptr = strrchr(filepath, '/');
|
|
|
|
if(ptr)
|
|
|
|
ptr[0] = 0;
|
|
|
|
|
|
|
|
CreateSubfolder(filepath);
|
|
|
|
|
|
|
|
FILE * f = fopen(ConfigPath.c_str(), "w");
|
|
|
|
if (!f) return false;
|
|
|
|
|
|
|
|
fprintf(f, "# USB Loader GX R%s - Individual game settings file\n", GetRev());
|
|
|
|
fprintf(f, "# note: this file is automatically generated\n");
|
|
|
|
fprintf(f, "# Num Games: %d\n", GameList.size());
|
|
|
|
for (u32 i = 0; i < GameList.size(); ++i)
|
|
|
|
{
|
|
|
|
fprintf(f, "game:%s = ", GameList[i].id);
|
|
|
|
fprintf(f, "video:%d; ", GameList[i].video);
|
* Improved GameCube controller functions (patch by Dynamit)
R+Z=Screenshot, X=Gameinfo window, Y=Covers download
* Added Classic Controller and GameCube Controller support
in GameInfo window:
Right stick=3D Cover movement, X=Flip 3DCover 180°, L/R=Zoom
* Added Wifi6 and wifi10 pictures for GameInfo window.
(Thanks OriginalHamster)
* Added device priority selection for GameCube listing
in global Loader settings (SD->USB, or USB->SD)
* Added a "Use global" language setting for Gamecube games.
* Added support for USB devices with modified MBR's signature
to prevent WiiU's format message.
* Prevent Rockband cursor display on GameCube and WiiWare
games with "band" in the title (Crach bandicoot, Beach
Bandits, etc.)
* Added Dol's Video mode patcher in Loader/Game settings,
for games which couldn't be forced. (MadWorld, MotoGP08,
Mario Party 8, etc.)
♦ Region patch = Patches the dol's known video modes
to the region selected in "Video mode" setting,
but keep interlace/progressive references.
♦ ON = Patch all dol's known video modes to the one
selected in "Video mode" setting.
♦ ALL = Patch all dol's found video mode patterns
(even unknown video modes) to the one selected
in "Video mode" setting.
* DML: Updated DM(L) version detection up to v2.10
* DML: Automatically enable PADHook if Screenshot setting
is enabled
* DML: Fixed a bug where multiple video modes could be set
at the same time
* DEVO: Added a prompt if trying to launch a game from a
non FAT32 partition.
* DEVO: Added Direct Mapping Buttons setting (Devo r200+)
* DEVO: Added support for Language setting
* Language files updated: Chinese, French
2013-08-18 16:30:39 +02:00
|
|
|
fprintf(f, "videoPatchDol:%d; ", GameList[i].videoPatchDol);
|
2011-12-23 16:48:20 +01:00
|
|
|
fprintf(f, "aspectratio:%d; ", GameList[i].aspectratio);
|
2011-07-26 00:28:22 +02:00
|
|
|
fprintf(f, "language:%d; ", GameList[i].language);
|
|
|
|
fprintf(f, "ocarina:%d; ", GameList[i].ocarina);
|
|
|
|
fprintf(f, "vipatch:%d; ", GameList[i].vipatch);
|
|
|
|
fprintf(f, "ios:%d; ", GameList[i].ios);
|
|
|
|
fprintf(f, "parentalcontrol:%d; ", GameList[i].parentalcontrol);
|
|
|
|
fprintf(f, "errorfix002:%d; ", GameList[i].errorfix002);
|
|
|
|
fprintf(f, "iosreloadblock:%d; ", GameList[i].iosreloadblock);
|
|
|
|
fprintf(f, "patchcountrystrings:%d; ", GameList[i].patchcountrystrings);
|
|
|
|
fprintf(f, "loadalternatedol:%d; ", GameList[i].loadalternatedol);
|
|
|
|
fprintf(f, "alternatedolstart:%d; ", GameList[i].alternatedolstart);
|
2011-12-20 22:41:00 +01:00
|
|
|
fprintf(f, "alternatedolname:%s; ", GameList[i].alternatedolname.c_str());
|
2011-07-26 00:28:22 +02:00
|
|
|
fprintf(f, "returnTo:%d; ", GameList[i].returnTo);
|
|
|
|
fprintf(f, "sneekVideoPatch:%d; ", GameList[i].sneekVideoPatch);
|
2011-09-03 11:39:26 +02:00
|
|
|
fprintf(f, "NandEmuMode:%d; ", GameList[i].NandEmuMode);
|
2011-12-20 22:41:00 +01:00
|
|
|
fprintf(f, "NandEmuPath:%s; ", GameList[i].NandEmuPath.c_str());
|
2011-09-03 11:39:26 +02:00
|
|
|
fprintf(f, "Hooktype:%d; ", GameList[i].Hooktype);
|
|
|
|
fprintf(f, "WiirdDebugger:%d; ", GameList[i].WiirdDebugger);
|
2012-07-16 18:07:24 +02:00
|
|
|
fprintf(f, "GameCubeMode:%d; ", GameList[i].GameCubeMode);
|
2012-07-22 22:30:59 +02:00
|
|
|
fprintf(f, "DMLVideo:%d; ", GameList[i].DMLVideo);
|
2012-07-16 18:07:24 +02:00
|
|
|
fprintf(f, "DMLProgPatch:%d; ", GameList[i].DMLProgPatch);
|
2012-05-06 12:59:58 +02:00
|
|
|
fprintf(f, "DMLNMM:%d; ", GameList[i].DMLNMM);
|
|
|
|
fprintf(f, "DMLActivityLED:%d; ", GameList[i].DMLActivityLED);
|
|
|
|
fprintf(f, "DMLPADHOOK:%d; ", GameList[i].DMLPADHOOK);
|
2012-07-22 19:08:54 +02:00
|
|
|
fprintf(f, "DMLNoDisc2:%d; ", GameList[i].DMLNoDisc2);
|
2012-07-19 22:13:39 +02:00
|
|
|
fprintf(f, "DMLWidescreen:%d; ", GameList[i].DMLWidescreen);
|
2012-11-11 14:47:02 +01:00
|
|
|
fprintf(f, "DMLScreenshot:%d; ", GameList[i].DMLScreenshot);
|
2012-08-24 18:55:49 +02:00
|
|
|
fprintf(f, "DMLJPNPatch:%d; ", GameList[i].DMLJPNPatch);
|
2012-05-06 12:59:58 +02:00
|
|
|
fprintf(f, "DMLDebug:%d; ", GameList[i].DMLDebug);
|
2012-07-16 18:07:24 +02:00
|
|
|
fprintf(f, "DEVOMCEmulation:%d; ", GameList[i].DEVOMCEmulation);
|
2012-10-14 18:27:01 +02:00
|
|
|
fprintf(f, "DEVOWidescreen:%d; ", GameList[i].DEVOWidescreen);
|
|
|
|
fprintf(f, "DEVOActivityLED:%d; ", GameList[i].DEVOActivityLED);
|
2013-04-14 23:02:09 +02:00
|
|
|
fprintf(f, "DEVOFZeroAX:%d; ", GameList[i].DEVOFZeroAX);
|
|
|
|
fprintf(f, "DEVOTimerFix:%d; ", GameList[i].DEVOTimerFix);
|
* Improved GameCube controller functions (patch by Dynamit)
R+Z=Screenshot, X=Gameinfo window, Y=Covers download
* Added Classic Controller and GameCube Controller support
in GameInfo window:
Right stick=3D Cover movement, X=Flip 3DCover 180°, L/R=Zoom
* Added Wifi6 and wifi10 pictures for GameInfo window.
(Thanks OriginalHamster)
* Added device priority selection for GameCube listing
in global Loader settings (SD->USB, or USB->SD)
* Added a "Use global" language setting for Gamecube games.
* Added support for USB devices with modified MBR's signature
to prevent WiiU's format message.
* Prevent Rockband cursor display on GameCube and WiiWare
games with "band" in the title (Crach bandicoot, Beach
Bandits, etc.)
* Added Dol's Video mode patcher in Loader/Game settings,
for games which couldn't be forced. (MadWorld, MotoGP08,
Mario Party 8, etc.)
♦ Region patch = Patches the dol's known video modes
to the region selected in "Video mode" setting,
but keep interlace/progressive references.
♦ ON = Patch all dol's known video modes to the one
selected in "Video mode" setting.
♦ ALL = Patch all dol's found video mode patterns
(even unknown video modes) to the one selected
in "Video mode" setting.
* DML: Updated DM(L) version detection up to v2.10
* DML: Automatically enable PADHook if Screenshot setting
is enabled
* DML: Fixed a bug where multiple video modes could be set
at the same time
* DEVO: Added a prompt if trying to launch a game from a
non FAT32 partition.
* DEVO: Added Direct Mapping Buttons setting (Devo r200+)
* DEVO: Added support for Language setting
* Language files updated: Chinese, French
2013-08-18 16:30:39 +02:00
|
|
|
fprintf(f, "DEVODButtons:%d; ", GameList[i].DEVODButtons);
|
2011-07-26 00:28:22 +02:00
|
|
|
fprintf(f, "Locked:%d;\n", GameList[i].Locked);
|
|
|
|
}
|
|
|
|
fprintf(f, "# END\n");
|
|
|
|
fclose(f);
|
|
|
|
|
|
|
|
return true;
|
2010-09-24 23:22:01 +02:00
|
|
|
}
|
|
|
|
|
2011-12-20 22:41:00 +01:00
|
|
|
bool CGameSettings::SetSetting(GameCFG & game, const char *name, const char *value)
|
2010-09-24 23:22:01 +02:00
|
|
|
{
|
2011-07-26 00:28:22 +02:00
|
|
|
if (strcmp(name, "video") == 0)
|
|
|
|
{
|
2012-05-06 12:59:58 +02:00
|
|
|
game.video = atoi(value);
|
2011-07-26 00:28:22 +02:00
|
|
|
return true;
|
|
|
|
}
|
* Improved GameCube controller functions (patch by Dynamit)
R+Z=Screenshot, X=Gameinfo window, Y=Covers download
* Added Classic Controller and GameCube Controller support
in GameInfo window:
Right stick=3D Cover movement, X=Flip 3DCover 180°, L/R=Zoom
* Added Wifi6 and wifi10 pictures for GameInfo window.
(Thanks OriginalHamster)
* Added device priority selection for GameCube listing
in global Loader settings (SD->USB, or USB->SD)
* Added a "Use global" language setting for Gamecube games.
* Added support for USB devices with modified MBR's signature
to prevent WiiU's format message.
* Prevent Rockband cursor display on GameCube and WiiWare
games with "band" in the title (Crach bandicoot, Beach
Bandits, etc.)
* Added Dol's Video mode patcher in Loader/Game settings,
for games which couldn't be forced. (MadWorld, MotoGP08,
Mario Party 8, etc.)
♦ Region patch = Patches the dol's known video modes
to the region selected in "Video mode" setting,
but keep interlace/progressive references.
♦ ON = Patch all dol's known video modes to the one
selected in "Video mode" setting.
♦ ALL = Patch all dol's found video mode patterns
(even unknown video modes) to the one selected
in "Video mode" setting.
* DML: Updated DM(L) version detection up to v2.10
* DML: Automatically enable PADHook if Screenshot setting
is enabled
* DML: Fixed a bug where multiple video modes could be set
at the same time
* DEVO: Added a prompt if trying to launch a game from a
non FAT32 partition.
* DEVO: Added Direct Mapping Buttons setting (Devo r200+)
* DEVO: Added support for Language setting
* Language files updated: Chinese, French
2013-08-18 16:30:39 +02:00
|
|
|
if (strcmp(name, "videoPatchDol") == 0)
|
|
|
|
{
|
|
|
|
game.videoPatchDol = atoi(value);
|
|
|
|
return true;
|
|
|
|
}
|
2011-12-23 16:48:20 +01:00
|
|
|
else if(strcmp(name, "aspectratio") == 0)
|
|
|
|
{
|
2012-05-06 12:59:58 +02:00
|
|
|
game.aspectratio = atoi(value);
|
2011-12-23 16:48:20 +01:00
|
|
|
return true;
|
|
|
|
}
|
2011-07-26 00:28:22 +02:00
|
|
|
else if(strcmp(name, "language") == 0)
|
|
|
|
{
|
2012-05-06 12:59:58 +02:00
|
|
|
game.language = atoi(value);
|
2011-07-26 00:28:22 +02:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
else if(strcmp(name, "ocarina") == 0)
|
|
|
|
{
|
2012-05-06 12:59:58 +02:00
|
|
|
game.ocarina = atoi(value);
|
2011-07-26 00:28:22 +02:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
else if(strcmp(name, "vipatch") == 0)
|
|
|
|
{
|
2012-05-06 12:59:58 +02:00
|
|
|
game.vipatch = atoi(value);
|
2011-07-26 00:28:22 +02:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
else if(strcmp(name, "ios") == 0)
|
|
|
|
{
|
2012-05-06 12:59:58 +02:00
|
|
|
game.ios = atoi(value);
|
2011-07-26 00:28:22 +02:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
else if(strcmp(name, "parentalcontrol") == 0)
|
|
|
|
{
|
2012-05-06 12:59:58 +02:00
|
|
|
game.parentalcontrol = atoi(value);
|
2011-07-26 00:28:22 +02:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
else if(strcmp(name, "errorfix002") == 0)
|
|
|
|
{
|
2012-05-06 12:59:58 +02:00
|
|
|
game.errorfix002 = atoi(value);
|
2011-07-26 00:28:22 +02:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
else if(strcmp(name, "iosreloadblock") == 0)
|
|
|
|
{
|
2012-05-06 12:59:58 +02:00
|
|
|
game.iosreloadblock = atoi(value);
|
2011-07-26 00:28:22 +02:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
else if(strcmp(name, "loadalternatedol") == 0)
|
|
|
|
{
|
2012-05-06 12:59:58 +02:00
|
|
|
game.loadalternatedol = atoi(value);
|
2011-07-26 00:28:22 +02:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
else if(strcmp(name, "alternatedolstart") == 0)
|
|
|
|
{
|
2012-05-06 12:59:58 +02:00
|
|
|
game.alternatedolstart = atoi(value);
|
2011-07-26 00:28:22 +02:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
else if(strcmp(name, "patchcountrystrings") == 0)
|
|
|
|
{
|
2012-05-06 12:59:58 +02:00
|
|
|
game.patchcountrystrings = atoi(value);
|
2011-07-26 00:28:22 +02:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
else if(strcmp(name, "alternatedolname") == 0)
|
|
|
|
{
|
2011-12-20 22:41:00 +01:00
|
|
|
game.alternatedolname = value;
|
2011-07-26 00:28:22 +02:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
else if(strcmp(name, "returnTo") == 0)
|
|
|
|
{
|
2012-05-06 12:59:58 +02:00
|
|
|
game.returnTo = atoi(value);
|
2011-07-26 00:28:22 +02:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
else if(strcmp(name, "sneekVideoPatch") == 0)
|
|
|
|
{
|
2012-05-06 12:59:58 +02:00
|
|
|
game.sneekVideoPatch = atoi(value);
|
2011-07-26 00:28:22 +02:00
|
|
|
return true;
|
|
|
|
}
|
2011-09-03 11:39:26 +02:00
|
|
|
else if(strcmp(name, "NandEmuMode") == 0)
|
|
|
|
{
|
2012-05-06 12:59:58 +02:00
|
|
|
game.NandEmuMode = atoi(value);
|
2011-09-03 11:39:26 +02:00
|
|
|
return true;
|
|
|
|
}
|
2011-12-20 22:41:00 +01:00
|
|
|
else if(strcmp(name, "NandEmuPath") == 0)
|
|
|
|
{
|
|
|
|
game.NandEmuPath = value;
|
|
|
|
return true;
|
|
|
|
}
|
2011-09-03 11:39:26 +02:00
|
|
|
else if(strcmp(name, "Hooktype") == 0)
|
|
|
|
{
|
2012-05-06 12:59:58 +02:00
|
|
|
game.Hooktype = atoi(value);
|
2011-09-03 11:39:26 +02:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
else if(strcmp(name, "WiirdDebugger") == 0)
|
|
|
|
{
|
2012-05-06 12:59:58 +02:00
|
|
|
game.WiirdDebugger = atoi(value);
|
2011-09-03 11:39:26 +02:00
|
|
|
return true;
|
|
|
|
}
|
2011-07-26 00:28:22 +02:00
|
|
|
else if(strcmp(name, "Locked") == 0)
|
|
|
|
{
|
2012-05-06 12:59:58 +02:00
|
|
|
game.Locked = atoi(value);
|
|
|
|
return true;
|
|
|
|
}
|
2012-07-16 18:07:24 +02:00
|
|
|
else if(strcmp(name, "GameCubeMode") == 0)
|
2012-05-06 12:59:58 +02:00
|
|
|
{
|
2012-07-16 18:07:24 +02:00
|
|
|
game.GameCubeMode = atoi(value);
|
|
|
|
return true;
|
|
|
|
}
|
2012-07-22 22:30:59 +02:00
|
|
|
else if(strcmp(name, "DMLVideo") == 0)
|
|
|
|
{
|
|
|
|
game.DMLVideo = atoi(value);
|
|
|
|
return true;
|
|
|
|
}
|
2012-07-16 18:07:24 +02:00
|
|
|
else if(strcmp(name, "DMLProgPatch") == 0)
|
|
|
|
{
|
|
|
|
game.DMLProgPatch = atoi(value);
|
2012-05-06 12:59:58 +02:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
else if(strcmp(name, "DMLNMM") == 0)
|
|
|
|
{
|
|
|
|
game.DMLNMM = atoi(value);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
else if(strcmp(name, "DMLActivityLED") == 0)
|
|
|
|
{
|
|
|
|
game.DMLActivityLED = atoi(value);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
else if(strcmp(name, "DMLPADHOOK") == 0)
|
|
|
|
{
|
|
|
|
game.DMLPADHOOK = atoi(value);
|
|
|
|
return true;
|
|
|
|
}
|
2012-07-22 19:08:54 +02:00
|
|
|
else if(strcmp(name, "DMLNoDisc2") == 0)
|
|
|
|
{
|
|
|
|
game.DMLNoDisc2 = atoi(value);
|
|
|
|
return true;
|
|
|
|
}
|
2012-07-19 22:13:39 +02:00
|
|
|
else if(strcmp(name, "DMLWidescreen") == 0)
|
|
|
|
{
|
|
|
|
game.DMLWidescreen = atoi(value);
|
|
|
|
return true;
|
|
|
|
}
|
2012-11-11 14:47:02 +01:00
|
|
|
else if(strcmp(name, "DMLScreenshot") == 0)
|
|
|
|
{
|
|
|
|
game.DMLScreenshot = atoi(value);
|
|
|
|
return true;
|
|
|
|
}
|
2012-08-24 18:55:49 +02:00
|
|
|
else if(strcmp(name, "DMLJPNPatch") == 0)
|
|
|
|
{
|
|
|
|
game.DMLJPNPatch = atoi(value);
|
|
|
|
return true;
|
|
|
|
}
|
2012-05-06 12:59:58 +02:00
|
|
|
else if(strcmp(name, "DMLDebug") == 0)
|
|
|
|
{
|
|
|
|
game.DMLDebug = atoi(value);
|
2011-07-26 00:28:22 +02:00
|
|
|
return true;
|
|
|
|
}
|
2012-07-16 18:07:24 +02:00
|
|
|
else if(strcmp(name, "DEVOMCEmulation") == 0)
|
|
|
|
{
|
|
|
|
game.DEVOMCEmulation = atoi(value);
|
|
|
|
return true;
|
|
|
|
}
|
2012-10-14 18:27:01 +02:00
|
|
|
else if(strcmp(name, "DEVOWidescreen") == 0)
|
|
|
|
{
|
|
|
|
game.DEVOWidescreen = atoi(value);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
else if(strcmp(name, "DEVOActivityLED") == 0)
|
|
|
|
{
|
|
|
|
game.DEVOActivityLED = atoi(value);
|
|
|
|
return true;
|
|
|
|
}
|
2013-04-14 23:02:09 +02:00
|
|
|
else if(strcmp(name, "DEVOFZeroAX") == 0)
|
|
|
|
{
|
|
|
|
game.DEVOFZeroAX = atoi(value);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
else if(strcmp(name, "DEVOTimerFix") == 0)
|
|
|
|
{
|
|
|
|
game.DEVOTimerFix = atoi(value);
|
|
|
|
return true;
|
|
|
|
}
|
* Improved GameCube controller functions (patch by Dynamit)
R+Z=Screenshot, X=Gameinfo window, Y=Covers download
* Added Classic Controller and GameCube Controller support
in GameInfo window:
Right stick=3D Cover movement, X=Flip 3DCover 180°, L/R=Zoom
* Added Wifi6 and wifi10 pictures for GameInfo window.
(Thanks OriginalHamster)
* Added device priority selection for GameCube listing
in global Loader settings (SD->USB, or USB->SD)
* Added a "Use global" language setting for Gamecube games.
* Added support for USB devices with modified MBR's signature
to prevent WiiU's format message.
* Prevent Rockband cursor display on GameCube and WiiWare
games with "band" in the title (Crach bandicoot, Beach
Bandits, etc.)
* Added Dol's Video mode patcher in Loader/Game settings,
for games which couldn't be forced. (MadWorld, MotoGP08,
Mario Party 8, etc.)
♦ Region patch = Patches the dol's known video modes
to the region selected in "Video mode" setting,
but keep interlace/progressive references.
♦ ON = Patch all dol's known video modes to the one
selected in "Video mode" setting.
♦ ALL = Patch all dol's found video mode patterns
(even unknown video modes) to the one selected
in "Video mode" setting.
* DML: Updated DM(L) version detection up to v2.10
* DML: Automatically enable PADHook if Screenshot setting
is enabled
* DML: Fixed a bug where multiple video modes could be set
at the same time
* DEVO: Added a prompt if trying to launch a game from a
non FAT32 partition.
* DEVO: Added Direct Mapping Buttons setting (Devo r200+)
* DEVO: Added support for Language setting
* Language files updated: Chinese, French
2013-08-18 16:30:39 +02:00
|
|
|
else if(strcmp(name, "DEVODButtons") == 0)
|
|
|
|
{
|
|
|
|
game.DEVODButtons = atoi(value);
|
|
|
|
return true;
|
|
|
|
}
|
2011-07-26 00:28:22 +02:00
|
|
|
|
|
|
|
return false;
|
2010-09-24 23:22:01 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
bool CGameSettings::ReadGameID(const char * src, char * GameID, int size)
|
|
|
|
{
|
2011-07-26 00:28:22 +02:00
|
|
|
if(strncasecmp(src, "game:", 5) != 0)
|
|
|
|
return false;
|
2010-09-24 23:22:01 +02:00
|
|
|
|
2011-07-26 00:28:22 +02:00
|
|
|
char * ptr = strchr(src, ':');
|
|
|
|
if(!ptr)
|
|
|
|
return false;
|
2010-09-24 23:22:01 +02:00
|
|
|
|
2011-07-26 00:28:22 +02:00
|
|
|
ptr++;
|
2010-09-24 23:22:01 +02:00
|
|
|
|
2011-07-26 00:28:22 +02:00
|
|
|
int i = 0;
|
2010-09-24 23:22:01 +02:00
|
|
|
|
2011-07-26 00:28:22 +02:00
|
|
|
for(i = 0; i < size; i++, ptr++)
|
|
|
|
{
|
|
|
|
if(*ptr == ' ' || *ptr == '\0')
|
|
|
|
break;
|
2010-09-24 23:22:01 +02:00
|
|
|
|
2011-07-26 00:28:22 +02:00
|
|
|
GameID[i] = *ptr;
|
|
|
|
}
|
2010-09-24 23:22:01 +02:00
|
|
|
|
2011-07-26 00:28:22 +02:00
|
|
|
GameID[i] = 0;
|
2010-09-24 23:22:01 +02:00
|
|
|
|
2011-07-26 00:28:22 +02:00
|
|
|
return true;
|
2010-09-24 23:22:01 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void CGameSettings::ParseLine(char *line)
|
|
|
|
{
|
2011-07-26 00:28:22 +02:00
|
|
|
char GameID[8];
|
2010-09-24 23:22:01 +02:00
|
|
|
|
2011-07-26 00:28:22 +02:00
|
|
|
if(!ReadGameID(line, GameID, 6))
|
|
|
|
return;
|
2010-09-24 23:22:01 +02:00
|
|
|
|
2011-11-12 19:14:09 +01:00
|
|
|
if(strlen(GameID) != 6 && strlen(GameID) != 4)
|
2011-07-26 00:28:22 +02:00
|
|
|
return;
|
2010-09-25 10:51:44 +02:00
|
|
|
|
2011-07-26 00:28:22 +02:00
|
|
|
GameCFG NewCFG;
|
2011-12-20 22:41:00 +01:00
|
|
|
SetDefault(NewCFG);
|
2010-09-24 23:22:01 +02:00
|
|
|
|
2011-07-26 00:28:22 +02:00
|
|
|
strcpy(NewCFG.id, GameID);
|
2010-09-24 23:22:01 +02:00
|
|
|
|
2011-07-26 00:28:22 +02:00
|
|
|
char * LinePtr = strchr(line, '=');
|
2010-09-24 23:22:01 +02:00
|
|
|
|
2011-07-26 00:28:22 +02:00
|
|
|
while(LinePtr != NULL)
|
|
|
|
{
|
|
|
|
LinePtr++;
|
2010-09-24 23:22:01 +02:00
|
|
|
|
2011-07-26 00:28:22 +02:00
|
|
|
char * eq = strchr(LinePtr, ':');
|
2010-09-24 23:22:01 +02:00
|
|
|
|
2011-07-26 00:28:22 +02:00
|
|
|
if (!eq) break;
|
2010-09-24 23:22:01 +02:00
|
|
|
|
2011-12-20 22:41:00 +01:00
|
|
|
std::string name, value;
|
2010-09-24 23:22:01 +02:00
|
|
|
|
2011-12-20 22:41:00 +01:00
|
|
|
this->TrimLine(name, LinePtr, ':');
|
|
|
|
this->TrimLine(value, eq + 1, ';');
|
|
|
|
|
|
|
|
SetSetting(NewCFG, name.c_str(), value.c_str());
|
2010-09-24 23:22:01 +02:00
|
|
|
|
2011-07-26 00:28:22 +02:00
|
|
|
LinePtr = strchr(LinePtr, ';');
|
|
|
|
}
|
2010-09-24 23:43:46 +02:00
|
|
|
|
2011-07-26 00:28:22 +02:00
|
|
|
AddGame(NewCFG);
|
2010-09-24 23:22:01 +02:00
|
|
|
}
|
|
|
|
|
2011-12-20 22:41:00 +01:00
|
|
|
void CGameSettings::TrimLine(std::string &dest, const char *src, char stopChar)
|
2010-09-24 23:22:01 +02:00
|
|
|
{
|
2011-12-20 22:41:00 +01:00
|
|
|
if(!src)
|
|
|
|
return;
|
|
|
|
|
2011-07-26 00:28:22 +02:00
|
|
|
while (*src == ' ')
|
|
|
|
src++;
|
2010-09-24 23:22:01 +02:00
|
|
|
|
2011-12-20 22:41:00 +01:00
|
|
|
while(*src != 0)
|
2011-07-26 00:28:22 +02:00
|
|
|
{
|
2011-12-20 22:41:00 +01:00
|
|
|
if(*src == stopChar || *src == '\n' || *src == '\r')
|
2011-07-26 00:28:22 +02:00
|
|
|
break;
|
2010-09-24 23:22:01 +02:00
|
|
|
|
2011-12-20 22:41:00 +01:00
|
|
|
dest.push_back(*src);
|
|
|
|
src++;
|
2011-07-26 00:28:22 +02:00
|
|
|
}
|
2010-09-24 23:22:01 +02:00
|
|
|
}
|
2010-10-28 11:00:52 +02:00
|
|
|
|
|
|
|
int CGameSettings::GetPartenalPEGI(int parental)
|
|
|
|
{
|
|
|
|
switch(parental)
|
|
|
|
{
|
|
|
|
case 1: return 7;
|
|
|
|
case 2: return 12;
|
|
|
|
case 3: return 16;
|
|
|
|
case 4: return 18;
|
|
|
|
default: return -1;
|
|
|
|
}
|
|
|
|
}
|
2011-01-21 20:43:59 +01:00
|
|
|
|
2011-12-20 22:41:00 +01:00
|
|
|
void CGameSettings::SetDefault(GameCFG &game)
|
2011-01-21 20:43:59 +01:00
|
|
|
{
|
2011-12-20 22:41:00 +01:00
|
|
|
memset(game.id, 0, sizeof(game.id));
|
|
|
|
game.video = INHERIT;
|
* Improved GameCube controller functions (patch by Dynamit)
R+Z=Screenshot, X=Gameinfo window, Y=Covers download
* Added Classic Controller and GameCube Controller support
in GameInfo window:
Right stick=3D Cover movement, X=Flip 3DCover 180°, L/R=Zoom
* Added Wifi6 and wifi10 pictures for GameInfo window.
(Thanks OriginalHamster)
* Added device priority selection for GameCube listing
in global Loader settings (SD->USB, or USB->SD)
* Added a "Use global" language setting for Gamecube games.
* Added support for USB devices with modified MBR's signature
to prevent WiiU's format message.
* Prevent Rockband cursor display on GameCube and WiiWare
games with "band" in the title (Crach bandicoot, Beach
Bandits, etc.)
* Added Dol's Video mode patcher in Loader/Game settings,
for games which couldn't be forced. (MadWorld, MotoGP08,
Mario Party 8, etc.)
♦ Region patch = Patches the dol's known video modes
to the region selected in "Video mode" setting,
but keep interlace/progressive references.
♦ ON = Patch all dol's known video modes to the one
selected in "Video mode" setting.
♦ ALL = Patch all dol's found video mode patterns
(even unknown video modes) to the one selected
in "Video mode" setting.
* DML: Updated DM(L) version detection up to v2.10
* DML: Automatically enable PADHook if Screenshot setting
is enabled
* DML: Fixed a bug where multiple video modes could be set
at the same time
* DEVO: Added a prompt if trying to launch a game from a
non FAT32 partition.
* DEVO: Added Direct Mapping Buttons setting (Devo r200+)
* DEVO: Added support for Language setting
* Language files updated: Chinese, French
2013-08-18 16:30:39 +02:00
|
|
|
game.videoPatchDol = INHERIT;
|
2011-12-23 16:48:20 +01:00
|
|
|
game.aspectratio = INHERIT;
|
2011-12-20 22:41:00 +01:00
|
|
|
game.language = INHERIT;
|
|
|
|
game.ocarina = INHERIT;
|
|
|
|
game.vipatch = INHERIT;
|
|
|
|
game.ios = INHERIT;
|
|
|
|
game.parentalcontrol = PARENTAL_LVL_EVERYONE;
|
|
|
|
game.errorfix002 = INHERIT;
|
|
|
|
game.patchcountrystrings = INHERIT;
|
|
|
|
game.loadalternatedol = ALT_DOL_DEFAULT;
|
|
|
|
game.alternatedolstart = 0;
|
|
|
|
game.iosreloadblock = INHERIT;
|
|
|
|
game.alternatedolname.clear();
|
2012-01-01 18:58:10 +01:00
|
|
|
game.returnTo = ON;
|
2011-12-20 22:41:00 +01:00
|
|
|
game.sneekVideoPatch = INHERIT;
|
|
|
|
game.NandEmuMode = INHERIT;
|
|
|
|
game.NandEmuPath.clear();
|
|
|
|
game.Hooktype = INHERIT;
|
|
|
|
game.WiirdDebugger = INHERIT;
|
2012-07-16 18:07:24 +02:00
|
|
|
game.GameCubeMode = INHERIT;
|
2012-07-22 22:30:59 +02:00
|
|
|
game.DMLVideo = INHERIT;
|
2012-07-16 18:07:24 +02:00
|
|
|
game.DMLProgPatch = INHERIT;
|
2012-05-06 12:59:58 +02:00
|
|
|
game.DMLNMM = INHERIT;
|
|
|
|
game.DMLActivityLED = INHERIT;
|
|
|
|
game.DMLPADHOOK = INHERIT;
|
2012-07-22 19:08:54 +02:00
|
|
|
game.DMLNoDisc2 = INHERIT;
|
2012-07-19 22:13:39 +02:00
|
|
|
game.DMLWidescreen = INHERIT;
|
2012-11-11 14:47:02 +01:00
|
|
|
game.DMLScreenshot = INHERIT;
|
2012-08-24 18:55:49 +02:00
|
|
|
game.DMLJPNPatch = INHERIT;
|
2012-05-06 12:59:58 +02:00
|
|
|
game.DMLDebug = INHERIT;
|
2012-07-16 18:07:24 +02:00
|
|
|
game.DEVOMCEmulation = INHERIT;
|
2012-10-14 18:27:01 +02:00
|
|
|
game.DEVOWidescreen = INHERIT;
|
|
|
|
game.DEVOActivityLED = INHERIT;
|
2013-04-14 23:02:09 +02:00
|
|
|
game.DEVOFZeroAX = INHERIT;
|
|
|
|
game.DEVOTimerFix = INHERIT;
|
* Improved GameCube controller functions (patch by Dynamit)
R+Z=Screenshot, X=Gameinfo window, Y=Covers download
* Added Classic Controller and GameCube Controller support
in GameInfo window:
Right stick=3D Cover movement, X=Flip 3DCover 180°, L/R=Zoom
* Added Wifi6 and wifi10 pictures for GameInfo window.
(Thanks OriginalHamster)
* Added device priority selection for GameCube listing
in global Loader settings (SD->USB, or USB->SD)
* Added a "Use global" language setting for Gamecube games.
* Added support for USB devices with modified MBR's signature
to prevent WiiU's format message.
* Prevent Rockband cursor display on GameCube and WiiWare
games with "band" in the title (Crach bandicoot, Beach
Bandits, etc.)
* Added Dol's Video mode patcher in Loader/Game settings,
for games which couldn't be forced. (MadWorld, MotoGP08,
Mario Party 8, etc.)
♦ Region patch = Patches the dol's known video modes
to the region selected in "Video mode" setting,
but keep interlace/progressive references.
♦ ON = Patch all dol's known video modes to the one
selected in "Video mode" setting.
♦ ALL = Patch all dol's found video mode patterns
(even unknown video modes) to the one selected
in "Video mode" setting.
* DML: Updated DM(L) version detection up to v2.10
* DML: Automatically enable PADHook if Screenshot setting
is enabled
* DML: Fixed a bug where multiple video modes could be set
at the same time
* DEVO: Added a prompt if trying to launch a game from a
non FAT32 partition.
* DEVO: Added Direct Mapping Buttons setting (Devo r200+)
* DEVO: Added support for Language setting
* Language files updated: Chinese, French
2013-08-18 16:30:39 +02:00
|
|
|
game.DEVODButtons = INHERIT;
|
2011-12-20 22:41:00 +01:00
|
|
|
game.Locked = OFF;
|
2011-01-21 20:43:59 +01:00
|
|
|
}
|