Fix MDEC CD speed, add FMV queue, remove release target

This commit is contained in:
Lucas S. Vieira 2024-08-30 20:31:00 -03:00
parent 5832c606fe
commit 2b159453e9
15 changed files with 72 additions and 58 deletions

View file

@ -21,22 +21,6 @@
"warnings": {
"dev": false
}
},
{
"name": "release",
"displayName": "Release configuration",
"description": "Build the project using PSn00bSDK on Release target",
"generator": "Unix Makefiles",
"toolchainFile": "$env{PSN00BSDK_LIBS}/cmake/sdk.cmake",
"binaryDir": "${sourceDir}/build",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Release",
"PSN00BSDK_TC": "",
"PSN00BSDK_TARGET": "mipsel-none-elf"
},
"warnings": {
"dev": false
}
}
]
}

View file

@ -31,12 +31,6 @@ run: ./build/engine.cue
emu:
2>/dev/null 1>&2 pcsx-redux -gdb -gdb-port 3333 -run -interpreter -fastboot &
# Build as release target
release: purge cook
cmake --preset release .
cd build && make iso
tochd -d . -- ./build/engine.cue
# Run debugger
debug:
gdb-multiarch

View file

@ -2,3 +2,4 @@
\rustyruin2.xa
\letmomsleep.xa
\letmomsleep2.xa
\youremyhero.xa

BIN
assets/bgm/BGM003.XA Normal file

Binary file not shown.

4
assets/bgm/BGM003.txt Normal file
View file

@ -0,0 +1,4 @@
1 xa youremyhero.xa 1 0
1 null
1 null
1 null

BIN
assets/bgm/youremyhero.flac Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

View file

@ -1,6 +1,6 @@
#!/bin/bash
for f in *.mp4; do
psxavenc -t str2 -f 37800 -b 4 -c 2 -s 320x240 -r 15 -x 1 "$f" "${f%%.mp4}.STR"
psxavenc -t str2 -f 37800 -b 4 -c 2 -s 320x240 -r 15 -x 2 "$f" "${f%%.mp4}.STR"
done

View file

@ -9,6 +9,6 @@ void screen_fmv_update();
void screen_fmv_draw();
void screen_fmv_set_next(ScreenIndex next);
void screen_fmv_set_path(const char *filepath);
void screen_fmv_enqueue(const char *filepath);
#endif

View file

@ -111,6 +111,9 @@
<file name="BGM002.XA"
type="xa"
source="${PROJECT_SOURCE_DIR}/assets/bgm/BGM002.XA" />
<file name="BGM003.XA"
type="xa"
source="${PROJECT_SOURCE_DIR}/assets/bgm/BGM003.XA" />
</dir>
<file name="INTRO.STR"

View file

@ -97,8 +97,7 @@ mdec_start(const char *filepath)
// Read at 2x speed to play any XA-ADPCM sectors that could be
// interleaved with the data
// Start reading in real-time mode (doesn't retry in case of errors).
//uint8_t mode = CdlModeRT | CdlModeSpeed;
uint8_t mode = CdlModeRT;
uint8_t mode = CdlModeRT | CdlModeSpeed;
CdControl(CdlSetmode, (const uint8_t *)&mode, 0);
CdControl(CdlReadS, &file.pos, 0);

View file

@ -15,20 +15,23 @@ static uint16_t disclaimer_timer = 0;
extern int debug_mode;
void screen_disclaimer_load()
void
screen_disclaimer_load()
{
uint32_t length;
disclaimer_bg = file_read("\\MISC\\DISK.TIM;1", &length);
}
void screen_disclaimer_unload()
void
screen_disclaimer_unload()
{
free(disclaimer_bg);
disclaimer_bg = NULL;
disclaimer_timer = 0;
}
void screen_disclaimer_update()
void
screen_disclaimer_update()
{
if((pad_pressing(PAD_L1) && pad_pressed(PAD_R1)) ||
(pad_pressed(PAD_L1) && pad_pressing(PAD_R1))) {
@ -44,13 +47,15 @@ void screen_disclaimer_update()
// Prepare intro, but also prepare level
screen_level_setlevel(0);
screen_fmv_set_next(SCREEN_LEVEL);
screen_fmv_set_path("\\SONICT.STR;1");
screen_fmv_enqueue("\\SONICT.STR;1");
screen_fmv_enqueue("\\INTRO.STR;1");
scene_change(SCREEN_FMV);
}
}
}
void screen_disclaimer_draw()
void
screen_disclaimer_draw()
{
TIM_IMAGE tim;
GetTimInfo((const uint32_t *)disclaimer_bg, &tim);

View file

@ -5,32 +5,46 @@
#include "screen.h"
#include "mdec.h"
#define FMV_QUEUE_MAX 3
// Default screen to level select.
// Can't wait for hackers using ACE to manipulate this someday :)
static ScreenIndex next_screen = SCREEN_LEVELSELECT;
static const char *fmv_path = NULL;
static const char *fmv_queue[FMV_QUEUE_MAX];
static uint8_t fmv_count = 0;
void screen_fmv_load() {}
void screen_fmv_unload() {}
void screen_fmv_update()
void
screen_fmv_unload()
{
mdec_play(fmv_path); // TODO: Interrupt playback?
fmv_count = 0;
}
void
screen_fmv_update()
{
for(uint8_t i = 0; i < fmv_count; i++)
mdec_play(fmv_queue[i]);
scene_change(next_screen);
}
void screen_fmv_draw() {}
void screen_fmv_set_next(ScreenIndex next)
void
screen_fmv_set_next(ScreenIndex next)
{
next_screen = next;
}
void screen_fmv_set_path(const char *filepath)
void
screen_fmv_enqueue(const char *filepath)
{
fmv_path = filepath;
if(fmv_count < FMV_QUEUE_MAX) {
fmv_queue[fmv_count] = filepath;
fmv_count++;
}
}

View file

@ -8,6 +8,7 @@
#include "render.h"
#include "screens/level.h"
#include "screens/fmv.h"
#include "sound.h"
#define CHOICE_SONICT 4
#define CHOICE_INTRO 5
@ -17,14 +18,22 @@ static uint8_t menu_choice = 0;
extern int debug_mode;
void screen_levelselect_load()
void
screen_levelselect_load()
{
menu_choice = 0;
sound_stop_xa();
sound_play_xa("\\BGM\\BGM003.XA;1", 0, 0, 0);
}
void screen_levelselect_unload() {}
void
screen_levelselect_unload()
{
sound_stop_xa();
}
void screen_levelselect_update()
void
screen_levelselect_update()
{
if((pad_pressing(PAD_L1) && pad_pressed(PAD_R1)) ||
(pad_pressed(PAD_L1) && pad_pressing(PAD_R1))) {
@ -43,11 +52,11 @@ void screen_levelselect_update()
if(pad_pressed(PAD_START) || pad_pressed(PAD_CROSS)) {
if(menu_choice == CHOICE_INTRO) {
screen_fmv_set_next(SCREEN_LEVELSELECT);
screen_fmv_set_path("\\INTRO.STR;1");
screen_fmv_enqueue("\\INTRO.STR;1");
scene_change(SCREEN_FMV);
} else if(menu_choice == CHOICE_SONICT) {
screen_fmv_set_next(SCREEN_LEVELSELECT);
screen_fmv_set_path("\\SONICT.STR;1");
screen_fmv_enqueue("\\SONICT.STR;1");
scene_change(SCREEN_FMV);
} else {
screen_level_setlevel(menu_choice);
@ -56,7 +65,8 @@ void screen_levelselect_update()
}
}
void screen_levelselect_draw()
void
screen_levelselect_draw()
{
char buffer[255] = { 0 };
@ -65,20 +75,20 @@ void screen_levelselect_draw()
x = CENTERX - (strlen(title) * 4);
draw_text(x, 12, 0, title);
const char *subtitle = "https://luksamuk.codes/";
x = CENTERX - (strlen(subtitle) * 4);
draw_text(x, 24, 0, subtitle);
snprintf(buffer, 255, "%s %s", __DATE__, __TIME__);
x = SCREEN_XRES - (strlen(buffer) * 8) - 8;
draw_text(x, SCREEN_YRES - 24, 0, buffer);
x = CENTERX - (strlen(buffer) * 4);
draw_text(x, 24, 0, buffer);
const char *subtitle = "https://luksamuk.codes/";
x = SCREEN_XRES - (strlen(subtitle) * 8) - 8;
draw_text(x, SCREEN_YRES - 24, 0, subtitle);
snprintf(
buffer, 255,
"%c Round 0 Zone 1\n"
"%c Round 0 Zone 2\n"
"%c Round 1 Zone 1\n"
"%c Round 1 Zone 2\n"
"%c R0Z1\n"
"%c R0Z2\n"
"%c R1Z1\n"
"%c R1Z2\n"
"\n"
"\n"
"\n"
@ -90,8 +100,8 @@ void screen_levelselect_draw()
"\n"
"\n"
"\n"
"%c SonicT\n"
"%c Intro",
"%c FMV:SONICT\n"
"%c FMV:INTRO",
(menu_choice == 0) ? '>' : ' ',
(menu_choice == 1) ? '>' : ' ',
(menu_choice == 2) ? '>' : ' ',