This commit is contained in:
zilmar 2016-02-11 20:59:39 +11:00
commit d06359447e
5 changed files with 45 additions and 28 deletions

View File

@ -5,7 +5,7 @@
#1 # "Português Brasileiro" // LANGUAGE ID #1 # "Português Brasileiro" // LANGUAGE ID
#2 # "Project64 team" // Author #2 # "Project64 team" // Author
#3 # "2.2" // Version #3 # "2.2" // Version
#4 # "Dezembro, 2015" // Date #4 # "Fevereiro, 2016" // Date
//About DLL Dialog //About DLL Dialog
#5 # "Idioma Atual" #5 # "Idioma Atual"
@ -96,6 +96,7 @@
#212# "Editar as Configurações do Jogo" #212# "Editar as Configurações do Jogo"
#213# "Editar as Trapaças" #213# "Editar as Trapaças"
#214# "Plugin Gráfico" #214# "Plugin Gráfico"
#215# "Jogar com Disco"
//Alternate Name to save Slot //Alternate Name to save Slot
#220# "Slot Padrão" #220# "Slot Padrão"

View File

@ -14,7 +14,7 @@ class Mempak
{ {
public: public:
static uint8_t CalculateCrc(uint8_t * DataToCrc); static uint8_t CalculateCrc(uint8_t * DataToCrc);
static void Load(); static void Load(int32_t Control);
static void Format(int32_t Control); static void Format(int32_t Control);
static void ReadFrom(int32_t Control, uint32_t address, uint8_t * data); static void ReadFrom(int32_t Control, uint32_t address, uint8_t * data);
static void WriteTo(int32_t Control, uint32_t address, uint8_t * data); static void WriteTo(int32_t Control, uint32_t address, uint8_t * data);

View File

@ -17,30 +17,27 @@
uint8_t Mempaks[4][128 * 256]; /* [CONTROLLERS][PAGES][BYTES_PER_PAGE] */ uint8_t Mempaks[4][128 * 256]; /* [CONTROLLERS][PAGES][BYTES_PER_PAGE] */
CPath MempakNames[4]; CPath MempakNames[4];
void Mempak::Load() void Mempak::Load(int32_t Control)
{ {
stdstr MempakName; stdstr MempakName;
for (int i = 0; i < 3; i++) MempakName.Format("%s_Cont_%d", g_Settings->LoadStringVal(Game_GameName).c_str(), Control + 1);
MempakNames[Control] = CPath(g_Settings->LoadStringVal(Directory_NativeSave).c_str(), stdstr_f("%s.mpk",MempakName.c_str()).c_str());
if (!MempakNames[Control].DirectoryExists())
{ {
MempakName.Format("%s_Cont_%d", g_Settings->LoadStringVal(Game_GameName).c_str(), i + 1); MempakNames[Control].DirectoryCreate();
}
MempakNames[i] = CPath(g_Settings->LoadStringVal(Directory_NativeSave).c_str(), stdstr_f("%s.mpk",MempakName.c_str()).c_str()); if (MempakNames[Control].Exists())
if (!MempakNames[i].DirectoryExists()) {
{ FILE *mempak = fopen(MempakNames[Control], "rb");
MempakNames[i].DirectoryCreate(); fread(Mempaks[Control], 1, 0x8000, mempak);
} fclose(mempak);
}
if (MempakNames[i].Exists()) else
{ {
FILE *mempak = fopen(MempakNames[i], "rb"); Mempak::Format(Control);
fread(Mempaks[i], 1, 0x8000, mempak);
fclose(mempak);
}
else
{
Mempak::Format(i);
}
} }
} }

View File

@ -21,11 +21,13 @@ uint16_t gb_cart_address(unsigned int bank, uint16_t address)
void Transferpak::Init() void Transferpak::Init()
{ {
//Quick check to ensure we dont have a ROM already
memset(&tpak, 0, sizeof(tpak)); if (tpak.gb_cart.rom == NULL)
tpak.access_mode = (!GBCart::init_gb_cart(&tpak.gb_cart, g_Settings->LoadStringVal(Game_Transferpak_ROM).c_str())) ? CART_NOT_INSERTED : CART_ACCESS_MODE_0; {
memset(&tpak, 0, sizeof(tpak));
tpak.access_mode_changed = 0x44; tpak.access_mode = (!GBCart::init_gb_cart(&tpak.gb_cart, g_Settings->LoadStringVal(Game_Transferpak_ROM).c_str())) ? CART_NOT_INSERTED : CART_ACCESS_MODE_0;
tpak.access_mode_changed = 0x44;
}
} }
void Transferpak::Release() void Transferpak::Release()

View File

@ -66,8 +66,6 @@ m_CheatsSlectionChanged(false)
m_Limiter.SetHertz(gameHertz); m_Limiter.SetHertz(gameHertz);
g_Settings->SaveDword(GameRunning_ScreenHertz, gameHertz); g_Settings->SaveDword(GameRunning_ScreenHertz, gameHertz);
m_Cheats.LoadCheats(!g_Settings->LoadDword(Setting_RememberCheats), Plugins); m_Cheats.LoadCheats(!g_Settings->LoadDword(Setting_RememberCheats), Plugins);
Mempak::Load();
Transferpak::Init();
} }
CN64System::~CN64System() CN64System::~CN64System()
@ -694,6 +692,25 @@ bool CN64System::SetActiveSystem(bool bActive)
{ {
WriteTrace(TraceN64System, TraceError, "g_Plugins->Initiate Failed"); WriteTrace(TraceN64System, TraceError, "g_Plugins->Initiate Failed");
} }
else
{
CONTROL * Controllers = g_Plugins->Control()->PluginControllers();
for (int i = 0; i < 3; i++)
{
if (Controllers[i].Present)
{
switch (Controllers[i].Plugin)
{
case PLUGIN_TANSFER_PAK:
Transferpak::Init();
break;
case PLUGIN_MEMPAK:
Mempak::Load(i);
break;
}
}
}
}
} }
if (bReset) if (bReset)