Double checking formatting

This commit is contained in:
Remnants of Forgotten Disney 2023-11-29 08:28:55 -06:00
parent 0a45b08524
commit 8bb76ca58c
17 changed files with 112 additions and 92 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 975 B

After

Width:  |  Height:  |  Size: 1002 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 965 B

After

Width:  |  Height:  |  Size: 997 B

View File

@ -1,3 +1,5 @@
// Created by afska https://github.com/afska/gba-link-connection
#ifndef LINK_GPIO_H
#define LINK_GPIO_H

View File

@ -1,12 +0,0 @@
#ifndef DEBUG_H
#define DEBUG_H
#include <tonc.h>
#include <string>
#define testVar 1000
std::string intToHex(unsigned int num);
void printValueAt(vu32 testAdd);
std::string u8ToHexStr(vu8 inputNum);
#endif

View File

@ -1,10 +1,11 @@
#ifndef DEBUG_MODE_H
#define DEBUG_MODE_H
#define DEBUG_MODE false
#define DEBUG_MODE true
#define IGNORE_GAME_PAK true
#define IGNORE_LINK_CABLE true
#define DEBUG_GAME SAPPHIRE_ID
#define DEBUG_VERS VERS_1_1
#define DEBUG_VERS VERS_1_0
#define DEBUG_LANG LANG_ENG
#endif

View File

@ -1,4 +1,4 @@
//Created by StevenChaulk? https://github.com/stevenchaulk/arduino-poke-gen2
//Created by StevenChaulk https://github.com/stevenchaulk/arduino-poke-gen2
#ifndef GAMEBOY_COLOUR_H_
#define GAMEBOY_COLOUR_H_

View File

@ -1,3 +1,5 @@
//Created by StevenChaulk https://github.com/stevenchaulk/arduino-poke-gen2
#ifndef GB_LINK_H
/*

View File

@ -1,4 +1,4 @@
//Created by StevenChaulk? https://github.com/stevenchaulk/arduino-poke-gen2
//Created by StevenChaulk https://github.com/stevenchaulk/arduino-poke-gen2
#include <stdint.h>

View File

@ -1,4 +1,4 @@
//Created by StevenChaulk? https://github.com/stevenchaulk/arduino-poke-gen2
//Created by StevenChaulk https://github.com/stevenchaulk/arduino-poke-gen2
#ifndef POKEMON_TRADE_H_
#define POKEMON_TRADE_H_

View File

@ -27,6 +27,11 @@ public:
bool load_rom();
bool is_hoenn();
bool is_ruby_sapphire();
void print_rom_info();
int gamecode;
int version;
int language;
int loc_sendMonToPC;
int loc_gSpecialVar_0x8000;

View File

@ -1,55 +0,0 @@
#include <tonc.h>
#include <string>
#include "flash_mem.h"
#include "gba_flash.h"
#include "debug.h"
std::string arr[256] = {
"00", "01", "02", "03", "04", "05", "06", "07", "08", "09", "0A", "0B", "0C", "0D", "0E", "0F", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "1A", "1B", "1C", "1D", "1E", "1F", "20", "21", "22", "23", "24", "25", "26", "27", "28", "29", "2A", "2B", "2C", "2D", "2E", "2F", "30", "31", "32", "33", "34", "35", "36", "37", "38", "39", "3A", "3B", "3C", "3D", "3E", "3F", "40", "41", "42", "43", "44", "45", "46", "47", "48", "49", "4A", "4B", "4C", "4D", "4E", "4F", "50", "51", "52", "53", "54", "55", "56", "57", "58", "59", "5A", "5B", "5C", "5D", "5E", "5F", "60", "61", "62", "63", "64", "65", "66", "67", "68", "69", "6A", "6B", "6C", "6D", "6E", "6F", "70", "71", "72", "73", "74", "75", "76", "77", "78", "79", "7A", "7B", "7C", "7D", "7E", "7F", "80", "81", "82", "83", "84", "85", "86", "87", "88", "89", "8A", "8B", "8C", "8D", "8E", "8F", "90", "91", "92", "93", "94", "95", "96", "97", "98", "99", "9A", "9B", "9C", "9D", "9E", "9F", "A0", "A1", "A2", "A3", "A4", "A5", "A6", "A7", "A8", "A9", "AA", "AB", "AC", "AD", "AE", "AF", "B0", "B1", "B2", "B3", "B4", "B5", "B6", "B7", "B8", "B9", "BA", "BB", "BC", "BD", "BE", "BF", "C0", "C1", "C2", "C3", "C4", "C5", "C6", "C7", "C8", "C9", "CA", "CB", "CC", "CD", "CE", "CF", "D0", "D1", "D2", "D3", "D4", "D5", "D6", "D7", "D8", "D9", "DA", "DB", "DC", "DD", "DE", "DF", "E0", "E1", "E2", "E3", "E4", "E5", "E6", "E7", "E8", "E9", "EA", "EB", "EC", "ED", "EE", "EF", "F0", "F1", "F2", "F3", "F4", "F5", "F6", "F7", "F8", "F9", "FA", "FB", "FC", "FD", "FE", "FF"
};
std::string intToHex(unsigned int num)
{
return arr[num];
}
void printValueAt(vu32 testAdd)
{
u8 mem[4];
if (!flash_read(testAdd, &mem[0], 0x04))
{
vu32 testNum = *(vu32 *)mem;
std::string output =
"$" +
intToHex(testAdd >> 24 & 0xFF) +
intToHex(testAdd >> 16 & 0xFF) +
intToHex(testAdd >> 8 & 0xFF) +
intToHex(testAdd >> 0 & 0xFF) +
" = 0x" +
intToHex(testNum >> 0 & 0xFF) +
intToHex(testNum >> 8 & 0xFF) +
intToHex(testNum >> 16 & 0xFF) +
intToHex(testNum >> 24 & 0xFF);
tte_write(output.c_str());
}
else
{
std::string error = "$" +
intToHex(testAdd >> 24 & 0xFF) +
intToHex(testAdd >> 16 & 0xFF) +
intToHex(testAdd >> 8 & 0xFF) +
intToHex(testAdd >> 0 & 0xFF) +
" = ERROR";
tte_write(error.c_str());
}
}
std::string u8ToHexStr(vu8 inputNum){
std::string output = "";
for (int i = 0; i < 2; i++){
output = arr[(inputNum>>(i*4)) & 0xF] + output;
}
return "0x" + output;
}

View File

@ -1,3 +1,5 @@
// Original code created by StevenChaulk https://github.com/stevenchaulk/arduino-poke-gen2
#include <tonc.h>
#include <string>
#include "gameboy_colour.h"
@ -5,6 +7,7 @@
#include "output.h"
#include "LinkGPIO.h"
#include "script_array.h"
#include "debug_mode.h"
#define BYTE_INCOMPLETE 0
#define BYTE_COMPLETE 1
@ -46,7 +49,7 @@ char output[2];
std::string outHexStr(vu8 inputNum)
{
std::string out = "XX";
out[0] = (inputNum)&0xF;
out[0] = (inputNum) & 0xF;
out[1] = (inputNum >> 4) & 0xF;
return out;
}
@ -120,9 +123,12 @@ void setup()
LINK_SPI_SET_HIGH(REG_RCNT, LINK_SPI_BIT_GENERAL_PURPOSE_HIGH);
*/
tte_erase_screen();
tte_set_pos(0, 0);
tte_write("FEED ME POKEMON, I HUNGER!\n");
if (DEBUG_MODE)
{
tte_erase_screen();
tte_set_pos(0, 0);
tte_write("FEED ME POKEMON, I HUNGER!\n");
}
// digitalWrite(MOSI_, LOW);
linkGPIO->writePin(LinkGPIO::Pin::SO, 0);
@ -371,11 +377,14 @@ int transferBit(byte *party_data)
{
shift = 0;
out_data = handleIncomingByte(in_data); // in_data
print(
std::to_string(trade_centre_state_gen_II) + " " +
std::to_string(connection_state) + " " +
std::to_string(in_data) + " " +
std::to_string(out_data) + "\n");
if (DEBUG_MODE)
{
print(
std::to_string(trade_centre_state_gen_II) + " " +
std::to_string(connection_state) + " " +
std::to_string(in_data) + " " +
std::to_string(out_data) + "\n");
}
if (trade_centre_state_gen_II == SENDING_DATA)
{
party_data[0] = in_data;

View File

@ -3,7 +3,6 @@
#include <cstring>
// #include <maxmod.h> //Music
#include "debug.h"
#include "flash_mem.h"
#include "gba_flash.h"
#include "interrupt.h"
@ -33,10 +32,12 @@
/*
TODO:
- Center buttons?
- Credits (List all programs, people, and code- plus TPCI)
Post Beta:
- Better custom sprites (Progress, Fennel, Title)
- Add a % or x/250 for the Dream Dex
- Determine if transfered Shiny Pokemon are square/star sparkles
- Music and Sound Effects
- Simplify the sprite initalization
@ -54,6 +55,7 @@ Pokemon_Party party = Pokemon_Party();
int delay_counter = 0;
bool skip = true;
rom_data curr_rom;
/*
int test_main(void)
{
@ -186,7 +188,9 @@ void game_load_error(void)
void first_load_message(void)
{
while (key_hit(KEY_A)){}; // Wait until A is no longer being held
while (key_is_down(KEY_A))
{
}; // Wait until A is no longer being held
tte_set_pos(8, 0);
tte_set_ink(10);
tte_write("#{cx:0xE000}Hello! Thank you for using\nPok@mon Mirror!\n\nJust as a word of caution- \nPok@mon Mirror WILL modify\nyour generation 3 save file.\nThe program is designed to\nnot corrupt anything, but if\nyou do not wish to modify\nyour save file, please turn\noff your Game Boy Advance.\n\nPlease note that Pok@mon\nMirror is still in beta, so\nsave file backups are HIGHLY\nrecommended before using.\nWith that all out of the\nway, please enjoy!\n\n -The Gears of Progress");
@ -260,13 +264,34 @@ int main(void)
int old_lang_btn_num = -1;
set_arrow_point(curr_lang_btn_num);
#define CREDITS_ARRAY_SIZE 14
int curr_credits_num = 0;
std::string credits_array[CREDITS_ARRAY_SIZE] = {
"Developed by:\n\n\nThe Gears\nof Progress",
"Developed using\nlibTONC from\ndevkitPro",
"Inspired by the\nworks of:\n\n-Goppier\n-Lorenzooone\n-im a blissey\n-RETIRE",
"Programs used:\n\n\n-HexManiacAdvance\n-PKHeX\n-WC3Tool\n-Usenti\n",
"Open Source Code and\nLibraries:\n\n-libtonc-examples\n-libsavgba\n-gba-link-connection\n-awesome-gbadev\n-arduino-poke-gen2",
"Research resources:\n\n-arm-docs\n-PokemonGen3toGenX\n\nFull links can be\nfound on this\nprogram's GitHub",
"ROM data obtained\nfrom decompilations created by the PRET team",
"Pok@mon data\nobtained from:\n\n-Bulbapedia\n-Serebii\n-PokeAPI.com",
"Discord community\nassistance:\n\n-Hex Maniac Advance\n Development\n-gbadev\n-pret",
"Sprite work:\n\n\n-lite_thespark",
"Writing assistance:\n\n\n-Mad",
"Special thanks:\n\n\nEnn, Roku, Luca,\nArctic, and everyone\nwho has listened to me talk about this\nfor months",
"All Pok@mon names,\nsprites, and names\nof related resources\nare copyright\nNintendo,\nCreatures Inc.,\nand GAME FREAK Inc.",
"This project is not endorsed or\nsupported by\nGameFreak/Nintendo.\n\nPlease support the\noriginal developers.",
};
curr_rom.load_rom();
// MAIN LOOP
while (1)
{
if (DEBUG_MODE){
if (DEBUG_MODE)
{
print_mem_section();
curr_rom.print_rom_info();
}
switch (main_menu_loop())
{
@ -323,13 +348,29 @@ int main(void)
}
break;
case (BTN_CREDITS):
tte_set_pos(0, 0);
tte_write("wow cool credits man");
tte_set_pos(40, 24);
tte_set_margins(40, 24, 206, 104);
tte_erase_screen();
tte_write(credits_array[curr_credits_num].c_str());
REG_BG0CNT = (REG_BG0CNT & ~BG_PRIO_MASK) | BG_PRIO(3);
REG_BG2CNT = (REG_BG2CNT & ~BG_PRIO_MASK) | BG_PRIO(2);
REG_BG2VOFS = 0;
if (key_hit(KEY_B))
{
tte_erase_rect(0, 0, H_MAX, V_MAX);
REG_BG0CNT = (REG_BG0CNT & ~BG_PRIO_MASK) | BG_PRIO(2);
REG_BG2CNT = (REG_BG2CNT & ~BG_PRIO_MASK) | BG_PRIO(3);
REG_BG2VOFS = 96;
main_menu_exit();
}
if (key_hit(KEY_LEFT) && curr_credits_num > 0)
{
curr_credits_num--;
}
if (key_hit(KEY_RIGHT) && curr_credits_num < (CREDITS_ARRAY_SIZE - 1))
{
curr_credits_num++;
}
break;
}

View File

@ -585,6 +585,7 @@ u32 Pokemon::generate_pid(byte pid_species_index, byte nature, byte *pid_dvs)
// Randomize rest of PID
new_pid |= get_rand_u32() & 0xFFFFFF00;
// Set nature
while (new_pid % 25 != nature)
{
new_pid = new_pid + 256;

View File

@ -3,14 +3,10 @@
#include "pokemon_party.h"
#include "pokemon_data.h"
int gamecode;
int version;
int language;
rom_data::rom_data() {}
bool rom_data::load_rom()
{
if (DEBUG_MODE)
if (IGNORE_GAME_PAK)
{
gamecode = DEBUG_GAME;
version = DEBUG_VERS;
@ -153,4 +149,33 @@ bool rom_data::is_hoenn()
bool rom_data::is_ruby_sapphire()
{
return (gamecode == RUBY_ID || gamecode == SAPPHIRE_ID);
}
void rom_data::print_rom_info()
{
std::string out;
switch (gamecode)
{
case (RUBY_ID):
out += "R";
break;
case (SAPPHIRE_ID):
out += "S";
break;
case (FIRERED_ID):
out += "F";
break;
case (LEAFGREEN_ID):
out += "L";
break;
case (EMERALD_ID):
out += "E";
break;
}
out += "-";
out += std::to_string(version);
out += "-";
out += char(language);
tte_set_pos(0, 8);
tte_write(out.c_str());
}

View File

@ -20,7 +20,7 @@ void populate_dialogue()
dialogue[DIA_MG_RS] = "Sorry trainer, one more\nthing to take care of before\nwe can begin- you need to\nenable MYSTERY EVENT!|Head to the PETALBURG\nPok@mon Center and tell the\nman next to the PC:\nMYSTERY EVENT IS EXCITING|After that, you should be\nall set to go!|See you soon!";
dialogue[DIA_LETS_START] = "Let's get started!";
dialogue[DIA_START] = "On a second Game Boy family\nsystem, please load the Game\nBoy Pok@mon game you wish to\ntransfer from.|In your Game Boy Pok@mon\ngame, put any Pokemon you\nwant to bring out of\nyour dreams into your party.|Then connect this Game Boy\nAdvance to the other Game\nBoy family system using a\nGame Boy Color link cable.|Once you're ready, press A\non this device, talk to the Cable Club attendant, and\nthen initiate a trade.";
dialogue[DIA_TRANS_GOOD] = "Amazing! Fantastic!\nEverything went perfectly!";
dialogue[DIA_TRANS_GOOD] = "Amazing! Fantastic!\nEverything went perfectly!|You may now turn off your Game Boy family system.";
dialogue[DIA_NEW_DEX] = "It looks like there's at\nleast one new Pokemon here\nthat isn't in the Dream Dex!|I'll give them something\nextra sweet as a reward for you both.";
dialogue[DIA_NO_NEW_DEX] = "It doesn't look like there's\nanything new for your Dream\nDex, but that's okay!|It's important to confirm\nresearch results with\nmultiple tests!";
dialogue[DIA_SEND_FRIEND_KANTO] = "I'm going to send these\nPokemon to my friend BILL so\nthat you can pick them up.\nThey live on Route 25!|Did you know they developed the Storage System for the\nKanto region?|My younger sister developed a version of the Storage\nSystem too, so BILL is a\ngood friend of ours!";

View File

@ -40,6 +40,7 @@ void text_next_frame()
{
if (!disabled)
{
tte_set_margins(LEFT, TOP, RIGHT, BOTTOM);
tte_set_pos(LEFT, TOP);
if (char_index < curr_text.length() && curr_text.substr(char_index, 1) != "|")
{