Skip to content

Commit

Permalink
Update to 0.81
Browse files Browse the repository at this point in the history
- Updated to SWAT's new DreamShell-independent FatFs
- Menu now loads faster
- Remove extraneous source code and cleaned up files
- Final size is reduced
- Removed GDPlay asm
  • Loading branch information
darcagn committed Jan 25, 2025
1 parent 934ac35 commit 6a8baad
Show file tree
Hide file tree
Showing 49 changed files with 2,648 additions and 10,358 deletions.
15 changes: 4 additions & 11 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,10 @@ endif
HAVE_MKDCDISC := $(shell command -v mkdcdisc 2> /dev/null)

## Objects
FATFS = src/ds/src/fs/fat
DRIVERS = src/ds/src/drivers
UTILS = src/ds/src/utils

OBJS = src/main.o src/menu.o src/disc.o src/log.o src/utility.o \
src/bmfont.o src/descramble.o src/drawing.o src/input.o \
$(DRIVERS)/rtc.o $(DRIVERS)/sd.o $(DRIVERS)/spi.o \
$(FATFS)/../fs.o $(FATFS)/ff.o $(FATFS)/dc.o $(FATFS)/utils.o \
$(FATFS)/option/ccsbcs.o $(FATFS)/option/syscall.o \
$(UTILS)/../exec.o $(UTILS)/memcpy.o $(UTILS)/memset.o
src/bmfont.o src/drawing.o src/input.o \
src/fatfs/dc.o src/fatfs/dc_bdev.o src/fatfs/ff.o \
src/fatfs/option/ccsbcs.o src/fatfs/option/syscall.o

## Resources
RELEASE_DIR = release
Expand All @@ -34,7 +28,6 @@ ROMDISK_FILES = ebdragon.fnt ebdragon.tex $(WALLPAPER_FILE)
GZ_ROMDISK_FILES = dcload-ip.bin dcload-serial.bin rungd.bin

## Flags
KOS_CFLAGS += -Isrc -Isrc/ds/include -Isrc/ds/include/fatfs
KOS_CFLAGS += -DWALLPAPER_FILE="$(WALLPAPER_FILE)" -DWALLPAPER_RES=$(WALLPAPER_RES)
KOS_CFLAGS += -DDASH_VERSION="$(VERSION)"
ifneq ($(AUTOBOOT),0)
Expand Down Expand Up @@ -83,7 +76,7 @@ $(TARGET).bin: release-dir $(TARGET).elf

$(TARGET).cdi: release-dir $(TARGET).elf
ifneq ($(HAVE_MKDCDISC),)
mkdcdisc --author $(TARGET) -e $(TARGET).elf --no-mr -n $(TARGET)-$(VERSION) -r 20240818 -o release/$(TARGET).cdi
mkdcdisc --author $(TARGET) -e $(TARGET).elf --no-mr -n $(TARGET)-$(VERSION) -r 20250125 -o release/$(TARGET).cdi
else
$(info mkdcdisc utility not found in PATH. Skipping CDI generation.)
endif
Expand Down
2 changes: 1 addition & 1 deletion Makefile.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
TARGET = dreamdash

# Project version
VERSION = 0.8
VERSION = 0.81

# Autoboot applications if found
AUTOBOOT = 0
Expand Down
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ DreamDash is a replacement BIOS for Dreamcast power users and developers. It req
## How to Use
- [Set up KallistiOS on your computer](https://dreamcast.wiki/Getting_Started_with_Dreamcast_development).
- Compile KOS and the `zlib`/`libpng` kos-ports with `-Os` and `-flto=auto` in your `KOS_CFLAGS` to keep code size small.
- KOS master with commit ID `4346a85` is known to work properly.
- KOS master with commit ID `03b51ef` is known to work properly.
- Open a terminal and source your KOS environment, clone this repo, and change into this repo's directory.
- Run `make` to build `dreamdash.elf`. Run `kos-strip dreamdash.elf` and check the filesize. If larger than 500KB, it may not work and can produce a non-working BIOS image, so check your `KOS_CFLAGS` and try again.
- Run `make all` to build everything. Check the `release` directory for generated files:
Expand All @@ -37,6 +37,9 @@ DreamDash is a replacement BIOS for Dreamcast power users and developers. It req
- BIOS files with `nogdrom` are used on consoles with no GD-ROM drive installed (**currently untested!**)
- BIOS files with `32mb` are used on consoles with 32MB RAM modification
- Use DreamShell's BIOS Flasher application to write the `.bios` file to a Dreamcast's writeable BIOS flashROM.

## Discussion
A chat room is available on the [dreamcast.wiki Discord server](https://discord.gg/Bs6Fe4stzE). Join us!

## Acknowledgements
- **KallistiOS** and **DreamShell** - kernel and drivers for the underlying operating system
Expand Down
1 change: 1 addition & 0 deletions src/bmfont.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#include "bmfont.h"

int bmf_parse(const char *fntPath, BMFont *bmFont) {
Expand Down
80 changes: 0 additions & 80 deletions src/descramble.c

This file was deleted.

91 changes: 54 additions & 37 deletions src/disc.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,23 +10,22 @@
#include <kos.h>
#include <stdlib.h>
#include <zlib/zlib.h>

#include "disc.h"
#include "log.h"
#include "utility.h"

#define RUNGZ_FILE "/rd/rungd.bin.gz"
#define RUNGZ_SIZE 65280

ip_meta_t *ip_info;
static void *bios_patch;
static int cmd_response;
static int status;
static int disc_type;

kthread_t *check_gdrom_thd;
int kill_gdrom_thd = 0;

extern void gdplay_run_game(void *bios_patch);

static void set_info() {
int lba = 45150;
char pbuff[2048];
Expand Down Expand Up @@ -66,30 +65,38 @@ static void set_info() {
return;
}

printf("\nDisc header info:\n");
printf(" Hardware ID:\t%.*s\n", 16, ip_info->hardware_ID);
printf(" Maker ID:\t%.*s\n", 16, ip_info->maker_ID);
printf(" Header CRC:\t%.*s\n", 5, ip_info->ks);
printf(" Disc Number:\t%c of %c\n", ip_info->disk_num[0], ip_info->disk_num[2]);
printf(" Region(s):\t%.*s\n", 3, ip_info->country_codes);
printf(" Control:\t%.*s\n", 4, ip_info->ctrl);
printf(" Devices:\t%.*s\n", 1, ip_info->dev);
printf(" VGA support:\t%s\n", ip_info->VGA[0] == '1'? "Yes":"No");
printf(" Windows CE:\t%s\n", ip_info->WinCE[0] == '1'? "Yes":"No");
printf(" Product ID:\t%.*s\n", 10, ip_info->product_ID);
printf(" Version:\t%.*s\n", 6, ip_info->product_version);
printf(" Date:\t%c%c%c%c-%c%c-%c%c\n", ip_info->release_date[0],
ip_info->release_date[1],
ip_info->release_date[2],
ip_info->release_date[3],
ip_info->release_date[4],
ip_info->release_date[5],
ip_info->release_date[6],
ip_info->release_date[7]);
printf(" Boot file:\t%.*s\n", 16, ip_info->boot_file);
printf(" Developer:\t%.*s\n", 16, ip_info->software_maker_info);
printf(" Title:\t%.*s\n", 128, ip_info->title);

printf("\nDisc header info:\n"
"\tHardware ID:\t%.*s\n"
"\tMaker ID:\t%.*s\n"
"\tHeader CRC:\t%.*s\n"
"\tDisc Number:\t%c of %c\n"
"\tRegion(s):\t%.*s\n"
"\tControl:\t%.*s\n"
"\tDevices:\t%.*s\n"
"\tVGA support:\t%s\n"
"\tWindows CE:\t%s\n"
"\tProduct ID:\t%.*s\n"
"\tVersion:\t%.*s\n"
"\tDate:\t\t%c%c%c%c-%c%c-%c%c\n"
"\tBoot file:\t%.*s\n"
"\tDeveloper:\t%.*s\n"
"\tTitle:\t\t%.*s\n",
16, ip_info->hardware_ID,
16, ip_info->maker_ID,
5, ip_info->ks,
ip_info->disk_num[0], ip_info->disk_num[2],
3, ip_info->country_codes,
4, ip_info->ctrl,
1, ip_info->dev,
ip_info->VGA[0] == '1' ? "Yes" : "No",
ip_info->WinCE[0] == '1' ? "Yes" : "No",
10, ip_info->product_ID,
6, ip_info->product_version,
ip_info->release_date[0], ip_info->release_date[1], ip_info->release_date[2], ip_info->release_date[3],
ip_info->release_date[4], ip_info->release_date[5], ip_info->release_date[6], ip_info->release_date[7],
16, ip_info->boot_file,
16, ip_info->software_maker_info,
128, ip_info->title);
fflush(stdout);
}

Expand Down Expand Up @@ -124,26 +131,36 @@ static void *check_gdrom() {

void disc_launch(void) {
printf("Shutting down KOS and lauching disc... have fun!\n\n");
fflush(stdout);
kill_gdrom_thd = 1;
thd_join(check_gdrom_thd, NULL);

bios_patch = decompress_file_aligned("/rd/rungd.bin.gz", 32, RUNGZ_SIZE);
/* Open syscalls patch */
gzFile rungz = gzopen(RUNGZ_FILE, "rb");
if(!rungz) {
dash_log(DBG_ERROR, "Error opening %s!", RUNGZ_FILE);
return;
}

if(!bios_patch) {
dash_log(DBG_ERROR, "Error with BIOS patch!");
/* Decompress patched syscalls into place */
if(gzread(rungz, (void *)0x8C000100, RUNGZ_SIZE) != RUNGZ_SIZE) {
dash_log(DBG_ERROR, "Error decompressing %s!", RUNGZ_FILE);
return;
}

gdplay_run_game(bios_patch);
/* Clean up */
gzclose(rungz);
disc_shutdown();
fflush(stdout);

/* Disable and invalidate the cache */
*(volatile unsigned long *)0xFF00001C = 0x0808;

/* Bye bye! */
((void (*)(volatile unsigned short))0x8C000120)(0xFFF);
__builtin_unreachable();
}

void disc_shutdown(void) {
kill_gdrom_thd = 1;
thd_join(check_gdrom_thd, NULL);

if(bios_patch)
free(bios_patch);
}

int disc_init(void) {
Expand Down
3 changes: 2 additions & 1 deletion src/drawing.c
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
#include <png/png.h>
#include <string.h>
#include "drawing.h"

#include "bmfont.h"
#include "drawing.h"

static BMFont bmf_font;
static pvr_ptr_t bmf_tex = NULL;
Expand Down
18 changes: 0 additions & 18 deletions src/ds/include/drivers/g1_ide.h

This file was deleted.

70 changes: 0 additions & 70 deletions src/ds/include/drivers/rtc.h

This file was deleted.

Loading

0 comments on commit 6a8baad

Please sign in to comment.