mirror of
https://github.com/risingPhil/PokeMe64.git
synced 2026-03-27 04:34:45 -05:00
Merge remote-tracking branch 'origin/v0.3' into feature/automatically-reset-rtc-in-backed-up-save-file-for-gen2
This commit is contained in:
commit
b67210c193
10
Makefile
10
Makefile
|
|
@ -36,8 +36,12 @@ filesystem/%.sprite: assets/%.png
|
|||
@echo " [SPRITE] $@"
|
||||
$(N64_MKSPRITE) $(MKSPRITE_FLAGS) -o filesystem "$<"
|
||||
|
||||
filesystem/Arial.font64: MKFONT_FLAGS+=--size 11 --outline 1.0 --char-spacing 1.0 --range 20-E9
|
||||
filesystem/Arial-small.font64: MKFONT_FLAGS+=--size 10 --outline 1.0 --char-spacing 1.0 --range 20-E9
|
||||
# We also need Japanese characters
|
||||
# I wrote a program to determine the character ranges for the japanese characters actually used by
|
||||
# the gameboy games.
|
||||
filesystem/Arial.font64: MKFONT_FLAGS+= -v --size 11 --outline 1.0 --char-spacing 1.0 --range 20-E9 --range 2026-2026 --range 25B6-25B7 --range 25BC-25BC --range 2640-2640 --range 2642-2642 --range 3002-3002 --range 300C-300F --range 3041-3089 --range 308B-308D --range 308F-308F --range 3092-309C --range 30A1-30D7 --range 30DB-30EF --range 30F2-30F4 --range 30FB-30FC --range 5186-5186 --range FF1A-FF1A
|
||||
|
||||
filesystem/Arial-small.font64: MKFONT_FLAGS+=-v --size 10 --outline 1.0 --char-spacing 1.0 --range 20-E9 --range 2026-2026 --range 25B6-25B7 --range 25BC-25BC --range 2640-2640 --range 2642-2642 --range 3002-3002 --range 300C-300F --range 3041-3089 --range 308B-308D --range 308F-308F --range 3092-309C --range 30A1-30D7 --range 30DB-30EF --range 30F2-30F4 --range 30FB-30FC --range 5186-5186 --range FF1A-FF1A
|
||||
|
||||
filesystem/logo-libdragon.sprite: MKSPRITE_FLAGS += -f RGBA32
|
||||
filesystem/logo-bulbagarden.sprite: MKSPRITE_FLAGS += -f RGBA32
|
||||
|
|
@ -62,4 +66,4 @@ clean:
|
|||
rm -rf filesystem/*
|
||||
.PHONY: clean
|
||||
|
||||
-include $(wildcard $(BUILD_DIR)/*.d)
|
||||
-include $(wildcard $(BUILD_DIR)/*.d)
|
||||
|
|
|
|||
15
README.md
15
README.md
|
|
@ -12,7 +12,7 @@ I'm happy to accept pull requests if the community wants to do them.
|
|||
|
||||
# Current Features
|
||||
- Inject Generation 1 Distribution event Pokémon into Gen 1 cartridges. In practice, this just means all kinds of variants of Mew.
|
||||
- Inject Generation 2 Distribution event Pokémon into Gen 2 cartridges. This includes the Pokémon Center New York (PCNY) Distribution event ones.
|
||||
- Inject Generation 2 Distribution event Pokémon into Gen 2 cartridges. This includes the Japanese and Pokémon Center New York (PCNY) Distribution event ones!
|
||||
- Inject GS Ball into an actual Pokémon Crystal gameboy cartridge
|
||||
- Teach Pikachu Surf/Fly on Gen 1 cartridges
|
||||
- You don't have to use the transfer pak in controller 1. You can have it in a separate controller if you want. But the UI is still controlled with controller 1.
|
||||
|
|
@ -23,11 +23,15 @@ I'm happy to accept pull requests if the community wants to do them.
|
|||
- Make it easy to reset/reconfigure the Generation II game clock
|
||||
|
||||
# Limitations
|
||||
When using a Korean gen II pokémon game, the Pokémon names won't show correctly. This is because the character set of the Korean games is vastly different and much more complex. I don't have any personal stakes or interest in these games, so I just made them show as "poke-\<number\>" instead.
|
||||
- When using a Korean gen II pokémon game, neither the trainer name (in various screens) nor the pokémon name (in the stats screen) will be displayed in the UI. This is because our font doesn't have the Korean characters and I don't sufficiently care to add them because they're such niche versions.
|
||||
|
||||
PokeMe64 also doesn't support batteryless reproduction carts due to technical limitations. Unfortunately this means most reproduction carts can't be supported. (see the "Reproduction carts" section below).
|
||||
- When adding a Japanese pokémon to a non-Japanese cart, the trainer name will be replaced with "PokeMe64". This is because the non-japanese games don't include the Japanese character sets, so they can't display them.
|
||||
|
||||
Flashcarts also unfortunately can't be supported, because those load into a menu first. (and likely also run into the same hardware limitation as with batteryless repro carts)
|
||||
- When adding a non-Japanese pokémon to a Japanese cart, the trainer name will be replaced with "ポケメ64". (which, according to Google Translate, translates to Pokeme 64)
|
||||
|
||||
- PokeMe64 also doesn't support batteryless reproduction carts due to technical limitations. Unfortunately this means most reproduction carts can't be supported. (see the "Reproduction carts" section below).
|
||||
|
||||
- Flashcarts also unfortunately can't be supported, because those load into a menu first. (and likely also run into the same hardware limitation as with batteryless repro carts)
|
||||
|
||||
# Build
|
||||
|
||||
|
|
@ -70,9 +74,8 @@ But having it done with a Nintendo 64 feels more "real"/"official" and is easier
|
|||
- [~~Support batteryless reproduction cartridges~~](docs/Why_I_Had_To_Give_Up_On_Batteryless_Repros.md)
|
||||
- Make it possible to display your cartridge save file as a QR code and contribute to the 3DS' [PKSM](https://github.com/FlagBrew/PKSM) project to migrate the save file easily from gameboy cartridge to 3DS.
|
||||
- Make it possible to swap gameboy cartridge after using the reset button on the N64. (suggested by /u/bluemooncinco on reddit)
|
||||
- Add support for the Japanese distribution event pokémon
|
||||
- Make it possible to delete pokémon moves
|
||||
- Force reset of RTC on backed up save file after backing up a Gen II save.
|
||||
- Implement mystery gift.
|
||||
|
||||
I'm likely going to postpone the 3D stuff (intro and "trade" sequence) until I have implemented a lot of the other ideas here.
|
||||
|
||||
|
|
|
|||
Binary file not shown.
1
assets/Arial-small.ttf
Symbolic link
1
assets/Arial-small.ttf
Symbolic link
|
|
@ -0,0 +1 @@
|
|||
Arial.ttf
|
||||
BIN
assets/Arial.ttf
Executable file → Normal file
BIN
assets/Arial.ttf
Executable file → Normal file
Binary file not shown.
|
|
@ -22,8 +22,8 @@ public:
|
|||
void render(RDPQGraphics& gfx, const Rectangle& sceneBounds) override;
|
||||
protected:
|
||||
private:
|
||||
uint8_t fontIdArial_;
|
||||
uint8_t fontArialStyleWhiteId_;
|
||||
uint8_t fontIdMainFont_;
|
||||
uint8_t fontMainFontStyleWhiteId_;
|
||||
sprite_t* logoLibDragon_;
|
||||
sprite_t* logoBulbagarden_;
|
||||
sprite_t* logoRetroGameMechanicsExplained_;
|
||||
|
|
|
|||
|
|
@ -38,6 +38,8 @@ private:
|
|||
DialogData diagData_;
|
||||
TextRenderSettings pokeMe64TextSettings_;
|
||||
const char* gameTypeString_;
|
||||
// build up a random seed for srand(). I'm doing this in an attempt to truly randomize IVs and shininess.
|
||||
unsigned int randomSeed_;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
@ -22,8 +22,8 @@ private:
|
|||
sprite_t* pokeTransporterGBLogoSprite_;
|
||||
sprite_t* qrCodeSprite_;
|
||||
sprite_t* fennelPictureSprite_;
|
||||
uint8_t fontArialSmallId_;
|
||||
uint8_t fontArialSmallWhiteId_;
|
||||
uint8_t fontMainFontSmallId_;
|
||||
uint8_t fontMainFontSmallWhiteId_;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
@ -23,7 +23,7 @@ protected:
|
|||
|
||||
DialogWidget dialogWidget_;
|
||||
WidgetFocusChainSegment dialogFocusChainSegment_;
|
||||
uint8_t arialId_;
|
||||
uint8_t mainFontId_;
|
||||
uint8_t fontStyleWhiteId_;
|
||||
uint8_t fontStyleYellowId_;
|
||||
private:
|
||||
|
|
|
|||
|
|
@ -48,8 +48,8 @@ private:
|
|||
Gen2GameReader gen2GameReader_;
|
||||
sprite_t* menu9SliceSprite_;
|
||||
SpriteRenderSettings backgroundRenderSettings_;
|
||||
uint8_t fontArialSmallId_;
|
||||
uint8_t fontArialSmallWhiteId_;
|
||||
uint8_t fontMainFontSmallId_;
|
||||
uint8_t fontMainFontSmallWhiteId_;
|
||||
TextRenderSettings textSettings_;
|
||||
TextRenderSettings smallTextSettings_;
|
||||
TextRenderSettings statsSettings_;
|
||||
|
|
|
|||
|
|
@ -66,6 +66,22 @@ public:
|
|||
*/
|
||||
void switchGBSRAMBank(uint8_t bankIndex);
|
||||
|
||||
/**
|
||||
* For MBC1 controllers, this will effect the ROM or RAM modes, depending on what is written in $6000-$7FFF.
|
||||
* If the mode is 0 (default), the RAM bank will be locked to 0, but the extended banks (bankindex > 0x1F)
|
||||
* can be accessed in the 0x0000 - 0x3FFF range (thereby replacing bank 0) by modifying the 0x4000-0x5FFF registers.
|
||||
* However, in this mode, the RAM bank is locked to bank 0
|
||||
*
|
||||
* If the mode is 1, the RAM bank can be switched, but the extended rom banks (bankindex > 0x1F) can't be switched to.
|
||||
* In this mode 0x0000 - 0x3FFF is locked to rom bank 0.
|
||||
* Sources:
|
||||
* - https://retrocomputing.stackexchange.com/questions/11732/how-does-the-gameboys-memory-bank-switching-work
|
||||
* - https://gbdev.io/pandocs/MBC1.html
|
||||
*
|
||||
* For our use case though, we don't need mode 0.
|
||||
*/
|
||||
void switchMBC1BankingMode(uint8_t mode);
|
||||
|
||||
/**
|
||||
* @brief This function reads data from the specified gameboy address
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
Subproject commit 3d86aa80f57f07fe60043b0d4bfe12ea0db9f659
|
||||
Subproject commit 17232c46517804e1d9bc0e9e6f274a8f9f932297
|
||||
|
|
@ -40,8 +40,8 @@ SPECIAL THANKS TO:
|
|||
|
||||
AboutScene::AboutScene(SceneDependencies& deps, void*)
|
||||
: AbstractUIScene(deps)
|
||||
, fontIdArial_(1)
|
||||
, fontArialStyleWhiteId_(0)
|
||||
, fontIdMainFont_(1)
|
||||
, fontMainFontStyleWhiteId_(0)
|
||||
, logoLibDragon_(nullptr)
|
||||
, logoBulbagarden_(nullptr)
|
||||
, logoRetroGameMechanicsExplained_(nullptr)
|
||||
|
|
@ -70,14 +70,14 @@ AboutScene::AboutScene(SceneDependencies& deps, void*)
|
|||
})
|
||||
, bButtonPressed_(false)
|
||||
{
|
||||
fontIdArial_ = deps.fontManager.getFont("rom://Arial.font64");
|
||||
fontIdMainFont_ = deps.fontManager.getFont("rom://Arial.font64");
|
||||
|
||||
const rdpq_fontstyle_t arialWhite = {
|
||||
const rdpq_fontstyle_t mainFontWhite = {
|
||||
.color = RGBA32(0xFF, 0xFF, 0xFF, 0xFF),
|
||||
.outline_color = RGBA32(0, 0, 0, 0xFF)
|
||||
};
|
||||
|
||||
deps.fontManager.registerFontStyle(fontIdArial_, fontArialStyleWhiteId_, arialWhite);
|
||||
deps.fontManager.registerFontStyle(fontIdMainFont_, fontMainFontStyleWhiteId_, mainFontWhite);
|
||||
}
|
||||
|
||||
AboutScene::~AboutScene()
|
||||
|
|
@ -99,8 +99,8 @@ void AboutScene::init()
|
|||
|
||||
const TextWidgetStyle headerTextStyle = {
|
||||
.renderSettingsNotFocused = {
|
||||
.fontId = fontIdArial_,
|
||||
.fontStyleId = fontArialStyleWhiteId_,
|
||||
.fontId = fontIdMainFont_,
|
||||
.fontStyleId = fontMainFontStyleWhiteId_,
|
||||
.halign = ALIGN_CENTER
|
||||
}
|
||||
// ,.backgroundColor_ = 0xF801
|
||||
|
|
@ -108,15 +108,15 @@ void AboutScene::init()
|
|||
|
||||
const TextWidgetStyle commonLeftAlignedTextStyle = {
|
||||
.renderSettingsNotFocused = {
|
||||
.fontId = fontIdArial_,
|
||||
.fontStyleId = fontArialStyleWhiteId_,
|
||||
.fontId = fontIdMainFont_,
|
||||
.fontStyleId = fontMainFontStyleWhiteId_,
|
||||
.halign = ALIGN_LEFT
|
||||
}
|
||||
};
|
||||
const TextWidgetStyle commonCenterAlignedTextStyle = {
|
||||
.renderSettingsNotFocused = {
|
||||
.fontId = fontIdArial_,
|
||||
.fontStyleId = fontArialStyleWhiteId_,
|
||||
.fontId = fontIdMainFont_,
|
||||
.fontStyleId = fontMainFontStyleWhiteId_,
|
||||
.halign = ALIGN_CENTER
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -199,11 +199,11 @@ void DistributionPokemonListScene::setupMenu()
|
|||
.bounds = {0, 1, 20, 20}
|
||||
},
|
||||
.titleNotFocused = {
|
||||
.fontId = arialId_,
|
||||
.fontId = mainFontId_,
|
||||
.fontStyleId = fontStyleWhiteId_
|
||||
},
|
||||
.titleFocused = {
|
||||
.fontId = arialId_,
|
||||
.fontId = mainFontId_,
|
||||
.fontStyleId = fontStyleYellowId_
|
||||
},
|
||||
.leftMargin = 24,
|
||||
|
|
|
|||
|
|
@ -8,8 +8,11 @@
|
|||
#include "gen2/Gen2GameReader.h"
|
||||
#include "menu/MenuEntries.h"
|
||||
|
||||
#include <unistd.h>
|
||||
|
||||
static const Rectangle tpakDetectWidgetBounds = {60, 44, 200, 116};
|
||||
|
||||
|
||||
static void dialogFinishedCallback(void* context)
|
||||
{
|
||||
InitTransferPakScene* scene = (InitTransferPakScene*)context;
|
||||
|
|
@ -41,6 +44,7 @@ InitTransferPakScene::~InitTransferPakScene()
|
|||
|
||||
void InitTransferPakScene::init()
|
||||
{
|
||||
uint8_t systemEntropy[4];
|
||||
menu9SliceSprite_ = sprite_load("rom://menu-bg-9slice.sprite");
|
||||
|
||||
SceneWithDialogWidget::init();
|
||||
|
|
@ -49,10 +53,18 @@ void InitTransferPakScene::init()
|
|||
setFocusChain(&tpakDetectWidgetSegment_);
|
||||
|
||||
pokeMe64TextSettings_ = TextRenderSettings{
|
||||
.fontId = arialId_,
|
||||
.fontId = mainFontId_,
|
||||
.fontStyleId = fontStyleWhiteId_,
|
||||
.halign = ALIGN_CENTER
|
||||
};
|
||||
|
||||
// add some entropy for our rand() function.
|
||||
// we'll apply this later. Right before we go to the main menu.
|
||||
getentropy(systemEntropy, sizeof(systemEntropy));
|
||||
for(uint8_t i=0; i < sizeof(systemEntropy); ++i)
|
||||
{
|
||||
randomSeed_ += static_cast<unsigned int>(systemEntropy[i]) << (i * 8);
|
||||
}
|
||||
}
|
||||
|
||||
void InitTransferPakScene::destroy()
|
||||
|
|
@ -124,6 +136,11 @@ void InitTransferPakScene::onDialogDone()
|
|||
return;
|
||||
}
|
||||
|
||||
// add the number of ticks it took before we got to this point to our random seed
|
||||
randomSeed_ += static_cast<uint32_t>(get_ticks());
|
||||
// Now apply random seed to srand() before we get to the main menu.
|
||||
srand(randomSeed_);
|
||||
|
||||
deps_.sceneManager.switchScene(SceneType::MENU, deleteMenuSceneContext, menuContext);
|
||||
}
|
||||
|
||||
|
|
@ -185,7 +202,7 @@ void InitTransferPakScene::setupTPakDetectWidget()
|
|||
{
|
||||
const TransferPakDetectionWidgetStyle style = {
|
||||
.textSettings = {
|
||||
.fontId = arialId_,
|
||||
.fontId = mainFontId_,
|
||||
.fontStyleId = fontStyleWhiteId_,
|
||||
.halign = ALIGN_CENTER
|
||||
}
|
||||
|
|
@ -266,6 +283,7 @@ void InitTransferPakScene::loadSaveMetadata()
|
|||
TransferPakSaveManager saveManager(deps_.tpakManager);
|
||||
Gen1GameType gen1Type;
|
||||
Gen2GameType gen2Type;
|
||||
uint16_t trainerID = 0;
|
||||
|
||||
tpakDetectWidget_.retrieveGameType(gen1Type, gen2Type);
|
||||
|
||||
|
|
@ -275,6 +293,7 @@ void InitTransferPakScene::loadSaveMetadata()
|
|||
|
||||
Gen1GameReader gameReader(romReader, saveManager, gen1Type, language);
|
||||
const char* trainerName = gameReader.getTrainerName();
|
||||
trainerID = gameReader.getTrainerID();
|
||||
deps_.localization = static_cast<uint8_t>(language);
|
||||
strncpy(deps_.playerName, trainerName, sizeof(deps_.playerName) - 1);
|
||||
}
|
||||
|
|
@ -284,7 +303,23 @@ void InitTransferPakScene::loadSaveMetadata()
|
|||
|
||||
Gen2GameReader gameReader(romReader, saveManager, gen2Type, language);
|
||||
const char* trainerName = gameReader.getTrainerName();
|
||||
trainerID = gameReader.getTrainerID();
|
||||
deps_.localization = static_cast<uint8_t>(language);
|
||||
strncpy(deps_.playerName, trainerName, sizeof(deps_.playerName) - 1);
|
||||
if(language != Gen2LocalizationLanguage::KOREAN)
|
||||
{
|
||||
strncpy(deps_.playerName, trainerName, sizeof(deps_.playerName) - 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
const char fakePlayerName[] = "Trainer";
|
||||
memcpy(deps_.playerName, fakePlayerName, sizeof(fakePlayerName));
|
||||
}
|
||||
}
|
||||
|
||||
// add to our random seed to make sure our random numbers will be randomized.
|
||||
randomSeed_ += trainerID;
|
||||
for(uint8_t i=0; i < strlen(deps_.playerName); ++i)
|
||||
{
|
||||
randomSeed_ += deps_.playerName[i];
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -202,11 +202,11 @@ void MenuScene::setupMenu()
|
|||
const MenuItemStyle itemStyle = {
|
||||
.size = {160, 16},
|
||||
.titleNotFocused = {
|
||||
.fontId = arialId_,
|
||||
.fontId = mainFontId_,
|
||||
.fontStyleId = fontStyleWhiteId_
|
||||
},
|
||||
.titleFocused = {
|
||||
.fontId = arialId_,
|
||||
.fontId = mainFontId_,
|
||||
.fontStyleId = fontStyleYellowId_
|
||||
},
|
||||
.leftMargin = 35,
|
||||
|
|
|
|||
|
|
@ -20,8 +20,8 @@ PokeTransporterGBRefScene::PokeTransporterGBRefScene(SceneDependencies& deps, vo
|
|||
, pokeTransporterGBLogoSprite_(nullptr)
|
||||
, qrCodeSprite_(nullptr)
|
||||
, fennelPictureSprite_(nullptr)
|
||||
, fontArialSmallId_(0)
|
||||
, fontArialSmallWhiteId_(0)
|
||||
, fontMainFontSmallId_(0)
|
||||
, fontMainFontSmallWhiteId_(0)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
@ -35,13 +35,13 @@ void PokeTransporterGBRefScene::init()
|
|||
pokeTransporterGBLogoSprite_ = sprite_load("rom://logo-poketransporter-gb.sprite");
|
||||
qrCodeSprite_ = sprite_load("rom://qrcode-poketransporter-gb.sprite");
|
||||
fennelPictureSprite_ = sprite_load("rom://fennel-picture.sprite");
|
||||
fontArialSmallId_ = deps_.fontManager.getFont("rom://Arial-small.font64");
|
||||
fontMainFontSmallId_ = deps_.fontManager.getFont("rom://Arial-small.font64");
|
||||
|
||||
const rdpq_fontstyle_t arialWhite = {
|
||||
const rdpq_fontstyle_t mainFontWhite = {
|
||||
.color = RGBA32(0xFF, 0xFF, 0xFF, 0xFF),
|
||||
.outline_color = RGBA32(0, 0, 0, 0xFF)
|
||||
};
|
||||
deps_.fontManager.registerFontStyle(fontArialSmallId_, fontArialSmallWhiteId_, arialWhite);
|
||||
deps_.fontManager.registerFontStyle(fontMainFontSmallId_, fontMainFontSmallWhiteId_, mainFontWhite);
|
||||
|
||||
SceneWithDialogWidget::init();
|
||||
|
||||
|
|
@ -80,8 +80,8 @@ void PokeTransporterGBRefScene::render(RDPQGraphics& gfx, const Rectangle& scene
|
|||
.renderMode = SpriteRenderMode::NORMAL
|
||||
};
|
||||
TextRenderSettings textSettings = {
|
||||
.fontId = fontArialSmallId_,
|
||||
.fontStyleId = fontArialSmallWhiteId_
|
||||
.fontId = fontMainFontSmallId_,
|
||||
.fontStyleId = fontMainFontSmallWhiteId_
|
||||
};
|
||||
|
||||
gfx.drawSprite(logoRectangle, pokeTransporterGBLogoSprite_, renderSettings);
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ SceneWithDialogWidget::SceneWithDialogWidget(SceneDependencies& deps)
|
|||
, dialogFocusChainSegment_({
|
||||
.current = &dialogWidget_
|
||||
})
|
||||
, arialId_(1)
|
||||
, mainFontId_(1)
|
||||
, fontStyleWhiteId_(0)
|
||||
, fontStyleYellowId_(1)
|
||||
{
|
||||
|
|
@ -26,11 +26,11 @@ void SceneWithDialogWidget::init()
|
|||
.style = {
|
||||
.size = {140, 16},
|
||||
.titleNotFocused = {
|
||||
.fontId = arialId_,
|
||||
.fontId = mainFontId_,
|
||||
.fontStyleId = fontStyleWhiteId_
|
||||
},
|
||||
.titleFocused = {
|
||||
.fontId = arialId_,
|
||||
.fontId = mainFontId_,
|
||||
.fontStyleId = fontStyleYellowId_
|
||||
},
|
||||
.leftMargin = 5,
|
||||
|
|
@ -38,7 +38,7 @@ void SceneWithDialogWidget::init()
|
|||
}
|
||||
},
|
||||
.textSettings = {
|
||||
.fontId = arialId_,
|
||||
.fontId = mainFontId_,
|
||||
.fontStyleId = fontStyleWhiteId_
|
||||
},
|
||||
.margin = {
|
||||
|
|
@ -81,19 +81,19 @@ void SceneWithDialogWidget::showDialog(DialogData* diagData)
|
|||
|
||||
void SceneWithDialogWidget::setupFonts()
|
||||
{
|
||||
arialId_ = deps_.fontManager.getFont("rom://Arial.font64");
|
||||
mainFontId_ = deps_.fontManager.getFont("rom://Arial.font64");
|
||||
|
||||
const rdpq_fontstyle_t arialWhite = {
|
||||
const rdpq_fontstyle_t mainFontWhite = {
|
||||
.color = RGBA32(0xFF, 0xFF, 0xFF, 0xFF),
|
||||
.outline_color = RGBA32(0, 0, 0, 0xFF)
|
||||
};
|
||||
const rdpq_fontstyle_t arialYellow = {
|
||||
const rdpq_fontstyle_t mainFontYellow = {
|
||||
.color = RGBA32(0xFF, 0xFF, 0x00, 0xFF),
|
||||
.outline_color = RGBA32(0, 0, 0, 0xFF)
|
||||
};
|
||||
|
||||
deps_.fontManager.registerFontStyle(arialId_, fontStyleWhiteId_, arialWhite);
|
||||
deps_.fontManager.registerFontStyle(arialId_, fontStyleYellowId_, arialYellow);
|
||||
deps_.fontManager.registerFontStyle(mainFontId_, fontStyleWhiteId_, mainFontWhite);
|
||||
deps_.fontManager.registerFontStyle(mainFontId_, fontStyleYellowId_, mainFontYellow);
|
||||
}
|
||||
|
||||
void SceneWithDialogWidget::setupDialog(DialogWidgetStyle& style)
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ void SceneWithProgressBar::setupProgressBar(ProgressBarWidgetStyle& style)
|
|||
.color = RGBA32(0x0, 0x61, 0xFF, 0xFF)
|
||||
};
|
||||
style.textSettings = {
|
||||
.fontId = arialId_,
|
||||
.fontId = mainFontId_,
|
||||
.fontStyleId = fontStyleWhiteId_,
|
||||
.halign = ALIGN_CENTER,
|
||||
.valign = VALIGN_CENTER
|
||||
|
|
|
|||
|
|
@ -78,11 +78,11 @@ void SelectFileScene::init()
|
|||
.spriteBounds = { 5, 2, 16, 16}
|
||||
},
|
||||
.titleNotFocused = {
|
||||
.fontId = arialId_,
|
||||
.fontId = mainFontId_,
|
||||
.fontStyleId = fontStyleWhiteId_
|
||||
},
|
||||
.titleFocused = {
|
||||
.fontId = arialId_,
|
||||
.fontId = mainFontId_,
|
||||
.fontStyleId = fontStyleYellowId_
|
||||
},
|
||||
.leftMargin = 24,
|
||||
|
|
@ -187,7 +187,7 @@ void SelectFileScene::render(RDPQGraphics& gfx, const Rectangle& sceneBounds)
|
|||
if(context_->titleText && !isZeroSizeRectangle(titleBounds))
|
||||
{
|
||||
const TextRenderSettings renderSettings = {
|
||||
.fontId = arialId_,
|
||||
.fontId = mainFontId_,
|
||||
.fontStyleId = fontStyleWhiteId_,
|
||||
.halign = ALIGN_CENTER
|
||||
};
|
||||
|
|
|
|||
|
|
@ -66,18 +66,18 @@ StatsScene::StatsScene(SceneDependencies& deps, void* context)
|
|||
.renderMode = SpriteRenderMode::NINESLICE,
|
||||
.srcRect = Rectangle{6, 6, 6, 6}
|
||||
})
|
||||
, fontArialSmallId_(2)
|
||||
, fontArialSmallWhiteId_(0)
|
||||
, fontMainFontSmallId_(2)
|
||||
, fontMainFontSmallWhiteId_(0)
|
||||
, textSettings_(TextRenderSettings{
|
||||
.fontId = arialId_,
|
||||
.fontId = mainFontId_,
|
||||
.fontStyleId = fontStyleWhiteId_
|
||||
})
|
||||
, smallTextSettings_(TextRenderSettings{
|
||||
.fontId = fontArialSmallId_,
|
||||
.fontStyleId = fontArialSmallWhiteId_
|
||||
.fontId = fontMainFontSmallId_,
|
||||
.fontStyleId = fontMainFontSmallWhiteId_
|
||||
})
|
||||
, statsSettings_(TextRenderSettings{
|
||||
.fontId = arialId_,
|
||||
.fontId = mainFontId_,
|
||||
.fontStyleId = fontStyleWhiteId_,
|
||||
})
|
||||
, spriteBounds_(spriteBounds)
|
||||
|
|
@ -118,16 +118,16 @@ void StatsScene::init()
|
|||
bool shiny;
|
||||
|
||||
menu9SliceSprite_ = sprite_load("rom://menu-bg-9slice.sprite");
|
||||
fontArialSmallId_ = deps_.fontManager.getFont("rom://Arial-small.font64");
|
||||
fontMainFontSmallId_ = deps_.fontManager.getFont("rom://Arial-small.font64");
|
||||
trainerName = deps_.playerName;
|
||||
|
||||
SceneWithDialogWidget::init();
|
||||
|
||||
const rdpq_fontstyle_t arialWhite = {
|
||||
const rdpq_fontstyle_t mainFontWhite = {
|
||||
.color = RGBA32(0xFF, 0xFF, 0xFF, 0xFF),
|
||||
.outline_color = RGBA32(0, 0, 0, 0xFF)
|
||||
};
|
||||
deps_.fontManager.registerFontStyle(fontArialSmallId_, fontArialSmallWhiteId_, arialWhite);
|
||||
deps_.fontManager.registerFontStyle(fontMainFontSmallId_, fontMainFontSmallWhiteId_, mainFontWhite);
|
||||
deps_.tpakManager.setRAMEnabled(true);
|
||||
switch(deps_.generation)
|
||||
{
|
||||
|
|
@ -166,7 +166,7 @@ void StatsScene::init()
|
|||
move2Str = getMoveString(static_cast<Move>(context_->poke_g2.index_move2));
|
||||
move3Str = getMoveString(static_cast<Move>(context_->poke_g2.index_move3));
|
||||
move4Str = getMoveString(static_cast<Move>(context_->poke_g2.index_move4));
|
||||
pokeName = gen2GameReader_.getPokemonName(pokeIndex);
|
||||
pokeName = (deps_.localization != (uint8_t)Gen2LocalizationLanguage::KOREAN) ? gen2GameReader_.getPokemonName(pokeIndex) : "Pokémon";
|
||||
shiny = gen2_isPokemonShiny(context_->poke_g2);
|
||||
snprintf(pokeStatsString_, sizeof(pokeStatsString_), "ATK: %u\nDEF: %u\nSPEC. ATK: %u\nSPEC. DEF: %u\nSPEED: %u", atk, def, specAtk, specDef, speed);
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -53,11 +53,11 @@ void TestScene::init()
|
|||
.itemStyle = {
|
||||
.size = {280, 16},
|
||||
.titleNotFocused = {
|
||||
.fontId = arialId_,
|
||||
.fontId = mainFontId_,
|
||||
.fontStyleId = fontStyleWhiteId_
|
||||
},
|
||||
.titleFocused = {
|
||||
.fontId = arialId_,
|
||||
.fontId = mainFontId_,
|
||||
.fontStyleId = fontStyleYellowId_
|
||||
},
|
||||
.leftMargin = 10,
|
||||
|
|
|
|||
|
|
@ -180,10 +180,24 @@ void TransferPakManager::switchGBSRAMBank(uint8_t bankIndex)
|
|||
writeBufferSRAMBankOffset_ = 0xFFFF;
|
||||
}
|
||||
|
||||
void TransferPakManager::switchMBC1BankingMode(uint8_t mode)
|
||||
{
|
||||
uint8_t data[TPAK_BLOCK_SIZE];
|
||||
|
||||
debugf("[TransferPakManager]: %s(%hhu)\r\n", __FUNCTION__, mode);
|
||||
// make sure to finish any writes in the write buffer before switching
|
||||
finishWrites();
|
||||
|
||||
memset(data, mode, TPAK_BLOCK_SIZE);
|
||||
tpak_write(port_, 0x6000, data, TPAK_BLOCK_SIZE);
|
||||
|
||||
// invalidate read and write buffer
|
||||
readBufferBankOffset_ = 0xFFFF;
|
||||
writeBufferSRAMBankOffset_ = 0xFFFF;
|
||||
}
|
||||
|
||||
void TransferPakManager::read(uint16_t gbAddress, uint8_t* data, uint16_t size)
|
||||
{
|
||||
// debugf("[TransferPakManager]: %s(0x%x, %p, %u)\r\n", __FUNCTION__, gbAddress, data, size);
|
||||
|
||||
uint16_t bytesRemaining = size;
|
||||
uint8_t* cur = data;
|
||||
|
||||
|
|
|
|||
|
|
@ -293,6 +293,20 @@ bool TransferPakDetectionWidget::validateGameboyHeader()
|
|||
return false;
|
||||
}
|
||||
|
||||
// For MBC1 cartridges, we need to set the MBC1 banking mode to 1.
|
||||
// If we don't, we can't actually switch SRAM banks.
|
||||
// It looks like only the Japanese cartridges use MBC1 though.
|
||||
switch(cartridgeHeader.cartridge_type)
|
||||
{
|
||||
case GB_MBC1_RAM:
|
||||
case GB_MBC1_RAM_BATTERY:
|
||||
tpakManager_.switchMBC1BankingMode(1);
|
||||
break;
|
||||
default:
|
||||
// We don't need to do anything
|
||||
break;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user