Dreamcast: Fix build not working, also add classicube textures for default textures since Dreamcast build currently can't write any files

This commit is contained in:
UnknownShadow200 2023-09-30 15:22:23 +10:00
parent 2b34308d8d
commit 031da68c8e
3 changed files with 10 additions and 32 deletions

View File

@ -26,12 +26,6 @@ jobs:
NOTIFY_MESSAGE: 'Failed to compile Dreamcast build'
WEBHOOK_URL: '${{ secrets.WEBHOOK_URL }}'
- uses: ./.github/actions/upload_build
if: ${{ always() && steps.compile.outcome == 'success' }}
with:
SOURCE_FILE: 'ClassiCube-dc.elf'
DEST_NAME: 'ClassiCube-dc.elf'
- uses: ./.github/actions/upload_build
if: ${{ always() && steps.compile.outcome == 'success' }}
with:

View File

@ -10,12 +10,13 @@ LDFLAGS=-g
LIBS=-lm $(GLDC_LIB)
TARGET := ClassiCube-dc
CC_TEXTURES = classicube.zip
ifeq ($(strip $(KOS_BASE)),)
$(error "Please set KOS variables in your environment.")
endif
default: $(GLDC_LIB) $(BUILD_DIR) $(TARGET).cdi
default: $(CC_TEXTURES) $(GLDC_LIB) $(BUILD_DIR) $(TARGET).cdi
$(BUILD_DIR):
mkdir -p $(BUILD_DIR)
@ -23,6 +24,10 @@ $(BUILD_DIR):
$(GLDC_LIB):
$(MAKE) -C third_party/gldc
# TODO add textures to misc folder ?
$(CC_TEXTURES):
curl http://www.classicube.net/static/default.zip -o $@
$(BUILD_DIR)/%.o: src/%.c
kos-cc $(CFLAGS) -c $< -o $@
@ -43,6 +48,8 @@ $(TARGET)-scr.bin: $(TARGET).bin
$(TARGET).iso: $(TARGET)-scr.bin
mkdir -p ISO_FILES
cp $(TARGET)-scr.bin ISO_FILES/1ST_READ.BIN
mkdir -p ISO_FILES/texpacks
cp $(CC_TEXTURES) ISO_FILES/texpacks/classicube.zip
cp misc/dreamcast/IP.BIN IP.BIN
mkisofs -G IP.BIN -C 0,11702 -J -l -r -o $(TARGET).iso ISO_FILES
# genisoimage -V ClassiCube -G IP.BIN -joliet -rock -l -o $(TARGET).iso ISO_FILES

View File

@ -34,33 +34,12 @@ const char* Platform_AppNameSuffix = " Dreamcast";
*#########################################################################################################################*/
cc_uint64 Stopwatch_ElapsedMicroseconds(cc_uint64 beg, cc_uint64 end) {
if (end < beg) return 0;
return (end - beg) / 1000;
return end - beg;
}
// Borrowed from kos/kernel/arch/dreamcast/kernel/timer.c so it compiles
// with older toolchain versions
#define _PMCR_CTRL_0 ( *((volatile uint16*)(0xff000084)) )
#define _PMCTR_HIGH_0 ( *((volatile uint32*)(0xff100004)) )
#define _PMCTR_LOW_0 ( *((volatile uint32*)(0xff100008)) )
#define _PMCR_CLR 0x2000
#define _PMCR_PMENABLE 0x8000
#define _PMCR_RUN 0xc000
#define _PMCR_PMM_MASK 0x003f
#define _PMCR_CLOCK_TYPE_SHIFT 8
#define _NS_PER_CYCLE 5
#define _PMCR_COUNT_CPU_CYCLES 0
#define _PMCR_ELAPSED_TIME_MODE 0x23
cc_uint64 Stopwatch_Measure(void) {
uint64 cycles = (uint64)(_PMCTR_HIGH_0 & 0xFFFF) << 32 | _PMCTR_LOW_0;
return cycles * _NS_PER_CYCLE;
return timer_us_gettime64();
}
static void Stopwatch_Init(void) {
_PMCR_CTRL_0 &= ~(_PMCR_PMM_MASK | _PMCR_PMENABLE);
_PMCR_CTRL_0 |= _PMCR_CLR;
_PMCR_CTRL_0 = _PMCR_RUN | _PMCR_ELAPSED_TIME_MODE | (_PMCR_COUNT_CPU_CYCLES << _PMCR_CLOCK_TYPE_SHIFT);
}
// NOTE: If using newer toolchain versions, only need this:
// cc_uint64 Stopwatch_Measure(void) { return timer_ns_gettime64(); }
void Platform_Log(const char* msg, int len) {
fs_write(STDOUT_FILENO, msg, len);
@ -441,8 +420,6 @@ cc_result Process_StartOpen(const cc_string* args) {
}
void Platform_Init(void) {
Stopwatch_Init();
char cwd[600] = { 0 };
char* ptr = getcwd(cwd, 600);
Platform_Log1("WORKING DIR: %c", ptr);