Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
added initial cdi support
added support for SPI_REQ_ERROR
fixed SPI_REQ_SES response format
  • Loading branch information
inolen committed Jun 7, 2017
1 parent 5a8eea2 commit 78cf487
Show file tree
Hide file tree
Showing 13 changed files with 729 additions and 258 deletions.
2 changes: 2 additions & 0 deletions CMakeLists.txt
Expand Up @@ -162,7 +162,9 @@ set(REDREAM_SOURCES
src/core/string.c
src/hw/aica/aica.c
src/hw/arm7/arm7.c
src/hw/gdrom/cdi.c
src/hw/gdrom/disc.c
src/hw/gdrom/gdi.c
src/hw/gdrom/gdrom.c
src/hw/holly/holly.c
src/hw/maple/controller.c
Expand Down
2 changes: 1 addition & 1 deletion docs/_docs/running.md
Expand Up @@ -3,7 +3,7 @@ title: Running
---

```
redream --bios=path/to/dc_boot.bin --flash=path/to/dc_flash.bin <bin or gdi file>
redream --bios=path/to/dc_boot.bin --flash=path/to/dc_flash.bin <cdi, gdi or bin file>
```

Command line flags are loaded from and saved to `$HOME/.redream/flags` each run. This means that bios and flash path, etc. only need to be set on the first run.
Expand Down
38 changes: 19 additions & 19 deletions src/hw/dreamcast.c
Expand Up @@ -77,20 +77,6 @@ void dc_suspend(struct dreamcast *dc) {
dc->running = 0;
}

static int dc_load_gdi(struct dreamcast *dc, const char *path) {
struct disc *disc = disc_create_gdi(path);

if (!disc) {
return 0;
}

gdrom_set_disc(dc->gdrom, disc);
sh4_reset(dc->sh4, 0xa0000000);
dc_resume(dc);

return 1;
}

static int dc_load_bin(struct dreamcast *dc, const char *path) {
FILE *fp = fopen(path, "rb");
if (!fp) {
Expand All @@ -107,7 +93,7 @@ static int dc_load_bin(struct dreamcast *dc, const char *path) {
fclose(fp);

if (n != size) {
LOG_WARNING("BIN read failed");
LOG_WARNING("failed to read %s", path);
return 0;
}

Expand All @@ -117,6 +103,20 @@ static int dc_load_bin(struct dreamcast *dc, const char *path) {
return 1;
}

static int dc_load_disc(struct dreamcast *dc, const char *path) {
struct disc *disc = disc_create(path);

if (!disc) {
return 0;
}

gdrom_set_disc(dc->gdrom, disc);
sh4_reset(dc->sh4, 0xa0000000);
dc_resume(dc);

return 1;
}

int dc_load(struct dreamcast *dc, const char *path) {
if (!path) {
/* boot to main menu of no path specified */
Expand All @@ -125,14 +125,14 @@ int dc_load(struct dreamcast *dc, const char *path) {
return 1;
}

LOG_INFO("Loading %s", path);
LOG_INFO("loading %s", path);

if ((strstr(path, ".bin") && dc_load_bin(dc, path)) ||
(strstr(path, ".gdi") && dc_load_gdi(dc, path))) {
if (dc_load_disc(dc, path) || dc_load_bin(dc, path)) {
return 1;
}

LOG_WARNING("Failed to load %s", path);
LOG_WARNING("failed to load %s", path);

return 0;
}

Expand Down

0 comments on commit 78cf487

Please sign in to comment.