Use CDDA on PSX

This commit is contained in:
Jaby
2022-07-20 22:12:25 +02:00
committed by Jaby
parent a0bb6199c8
commit 9182707a39
3 changed files with 63 additions and 6 deletions

View File

@@ -1,8 +1,49 @@
#include "JabyEngine.h"
#include <types.h>
#include <libcd.h>
#include <libetc.h>
#include <libgte.h>
#include <libgpu.h>
#include <stdio.h>
int main()
{
printf("Hello Planschi!\n");
static CdlLOC TOC[100] = {0};
static void setup() {
ResetCallback();
//ResetGraph(0);
CdInit();
CdSetDebug(0);
//SetDispMask(1);
}
static int fill_toc() {
u_char param[4] = {0};
param[0] = CdlModeRept|CdlModeDA; // report ON / CD-DA ON
CdControlB(CdlSetmode, param, 0);
return CdGetToc(TOC); // TOC
}
static void play_track(int track) {
for(int n = 0; n < 100; n++) {
const auto& cur_toc = TOC[n];
printf("Now playing %i.) %x:%x:%x\n", n, cur_toc.minute, cur_toc.second, cur_toc.sector);
}
CdControlB(CdlSetloc, reinterpret_cast<u_char*>(&TOC[track]), 0); // seek to start of track "track"
CdControlB(CdlPlay, 0, 0); // play track
}
int main() {
setup();
const int track_count = fill_toc();
printf("Hello Planschi!\nI found %i tracks\n", track_count);
play_track(2);
while(true);
return 0;
}