mirror of
https://github.com/GearsProgress/Poke_Transporter_GB.git
synced 2026-10-24 00:13:40 -05:00
Applying formatting and moving libraries into specific folders
This commit is contained in:
@@ -1,71 +1,75 @@
|
||||
#include <tonc.h>
|
||||
|
||||
#include "global_frame_controller.h"
|
||||
#include "FileContainerReader.h"
|
||||
#include "background_engine.h"
|
||||
#include "global_frame_controller.h"
|
||||
#include "libraries/gba-link-connection/LinkCableMultiboot.hpp"
|
||||
#include "text_engine.h"
|
||||
#include "translated_text.h"
|
||||
#include "FileContainerReader.h"
|
||||
#include "text_tables.h"
|
||||
#include "translated_text.h"
|
||||
|
||||
void multiboot_upload_screen()
|
||||
{
|
||||
u8 decompression_buffer[2048];
|
||||
u8 lineBuffer[1024];
|
||||
const u8 **chunkList;
|
||||
u32 numChunks;
|
||||
u32 chunkSize;
|
||||
u8 decompression_buffer[2048];
|
||||
u8 lineBuffer[1024];
|
||||
const u8 **chunkList;
|
||||
u32 numChunks;
|
||||
u32 chunkSize;
|
||||
|
||||
get_text_table_chunks(GENERAL_INDEX, &chunkList, &numChunks, &chunkSize);
|
||||
FileContainerReader general_text_reader(chunkList, numChunks, chunkSize);
|
||||
LinkCableMultiboot linkCableMultiboot;
|
||||
get_text_table_chunks(GENERAL_INDEX, &chunkList, &numChunks, &chunkSize);
|
||||
FileContainerReader general_text_reader(chunkList, numChunks, chunkSize);
|
||||
LinkCableMultiboot linkCableMultiboot;
|
||||
|
||||
general_text_reader.init(decompression_buffer, sizeof(decompression_buffer));
|
||||
general_text_reader.init(
|
||||
decompression_buffer, sizeof(decompression_buffer));
|
||||
|
||||
// multiboot_show_textbox();
|
||||
general_text_reader.readFile(GENERAL_send_multiboot_instructions, lineBuffer);
|
||||
ptgb_write_textbox(lineBuffer, true,
|
||||
false, GENERAL_INDEX, GENERAL_send_multiboot_instructions, false);
|
||||
// multiboot_show_textbox();
|
||||
general_text_reader.readFile(
|
||||
GENERAL_send_multiboot_instructions, lineBuffer);
|
||||
ptgb_write_textbox(lineBuffer, true, false, GENERAL_INDEX,
|
||||
GENERAL_send_multiboot_instructions, false);
|
||||
|
||||
// wait for key press
|
||||
do
|
||||
{
|
||||
VBlankIntrWait();
|
||||
} while (!key_hit(KEY_A) && !key_hit(KEY_B));
|
||||
// wait for key press
|
||||
do
|
||||
{
|
||||
VBlankIntrWait();
|
||||
} while (!key_hit(KEY_A) && !key_hit(KEY_B));
|
||||
|
||||
if (key_hit(KEY_B))
|
||||
{
|
||||
// cancel
|
||||
return;
|
||||
}
|
||||
if (key_hit(KEY_B))
|
||||
{
|
||||
// cancel
|
||||
return;
|
||||
}
|
||||
|
||||
// start upload
|
||||
// multiboot_show_textbox();
|
||||
general_text_reader.readFile(GENERAL_send_multiboot_wait, lineBuffer);
|
||||
ptgb_write_textbox(lineBuffer, true,
|
||||
false, GENERAL_INDEX, GENERAL_send_multiboot_wait, false);
|
||||
VBlankIntrWait();
|
||||
// start upload
|
||||
// multiboot_show_textbox();
|
||||
general_text_reader.readFile(GENERAL_send_multiboot_wait, lineBuffer);
|
||||
ptgb_write_textbox(lineBuffer, true, false, GENERAL_INDEX,
|
||||
GENERAL_send_multiboot_wait, false);
|
||||
VBlankIntrWait();
|
||||
|
||||
const u32 romSize = 256 * 1024; // EWRAM = 256 KB
|
||||
LinkCableMultiboot::Result multibootResult = linkCableMultiboot.sendRom(
|
||||
((const u8 *)MEM_EWRAM),
|
||||
romSize,
|
||||
[]()
|
||||
{
|
||||
u16 keys = ~REG_KEYS & KEY_ANY;
|
||||
return keys & KEY_B;
|
||||
// (when this returns true, the transfer will be canceled)
|
||||
});
|
||||
// show result
|
||||
// multiboot_show_textbox();
|
||||
u32 fileIndex = (multibootResult == LinkCableMultiboot::Result::SUCCESS) ? GENERAL_send_multiboot_success : GENERAL_send_multiboot_failure;
|
||||
general_text_reader.readFile(fileIndex, lineBuffer);
|
||||
const u32 romSize = 256 * 1024; // EWRAM = 256 KB
|
||||
LinkCableMultiboot::Result multibootResult =
|
||||
linkCableMultiboot.sendRom(((const u8 *)MEM_EWRAM), romSize,
|
||||
[]()
|
||||
{
|
||||
u16 keys = ~REG_KEYS & KEY_ANY;
|
||||
return keys & KEY_B;
|
||||
// (when this returns true, the transfer will be canceled)
|
||||
});
|
||||
// show result
|
||||
// multiboot_show_textbox();
|
||||
u32 fileIndex = (multibootResult == LinkCableMultiboot::Result::SUCCESS)
|
||||
? GENERAL_send_multiboot_success
|
||||
: GENERAL_send_multiboot_failure;
|
||||
general_text_reader.readFile(fileIndex, lineBuffer);
|
||||
|
||||
ptgb_write_textbox(lineBuffer, true, false, GENERAL_INDEX, fileIndex, false);
|
||||
ptgb_write_textbox(
|
||||
lineBuffer, true, false, GENERAL_INDEX, fileIndex, false);
|
||||
|
||||
// wait for keypress again.
|
||||
do
|
||||
{
|
||||
VBlankIntrWait();
|
||||
} while (!key_hit(KEY_A));
|
||||
// wait for keypress again.
|
||||
do
|
||||
{
|
||||
VBlankIntrWait();
|
||||
} while (!key_hit(KEY_A));
|
||||
}
|
||||
Reference in New Issue
Block a user