mirror of
https://github.com/ClassiCube/ClassiCube.git
synced 2025-09-13 17:47:12 -04:00
Dreamcast: SD card support, maybe
This commit is contained in:
parent
7c3e5c735b
commit
acd4edb0b0
@ -7,7 +7,7 @@ CFLAGS :=-g -O1 -pipe -fno-math-errno -Ithird_party/bearssl/inc
|
|||||||
|
|
||||||
GLDC_LIB=third_party/gldc/libGLdc.a
|
GLDC_LIB=third_party/gldc/libGLdc.a
|
||||||
LDFLAGS=-g
|
LDFLAGS=-g
|
||||||
LIBS=-lm $(GLDC_LIB) -lppp
|
LIBS=-lm $(GLDC_LIB) -lppp -lkosfat
|
||||||
|
|
||||||
TARGET := ClassiCube-dc
|
TARGET := ClassiCube-dc
|
||||||
CC_TEXTURES = classicube.zip
|
CC_TEXTURES = classicube.zip
|
||||||
|
@ -19,6 +19,8 @@
|
|||||||
#include <time.h>
|
#include <time.h>
|
||||||
#include <ppp/ppp.h>
|
#include <ppp/ppp.h>
|
||||||
#include <kos.h>
|
#include <kos.h>
|
||||||
|
#include <dc/sd.h>
|
||||||
|
#include <fat/fs_fat.h>
|
||||||
#include "_PlatformConsole.h"
|
#include "_PlatformConsole.h"
|
||||||
KOS_INIT_FLAGS(INIT_DEFAULT | INIT_NET);
|
KOS_INIT_FLAGS(INIT_DEFAULT | INIT_NET);
|
||||||
|
|
||||||
@ -105,7 +107,7 @@ void DateTime_CurrentLocal(struct DateTime* t) {
|
|||||||
/*########################################################################################################################*
|
/*########################################################################################################################*
|
||||||
*-----------------------------------------------------Directory/File------------------------------------------------------*
|
*-----------------------------------------------------Directory/File------------------------------------------------------*
|
||||||
*#########################################################################################################################*/
|
*#########################################################################################################################*/
|
||||||
static const cc_string root_path = String_FromConst("/cd/");
|
static cc_string root_path = String_FromConst("/cd/");
|
||||||
|
|
||||||
static void GetNativePath(char* str, const cc_string* path) {
|
static void GetNativePath(char* str, const cc_string* path) {
|
||||||
Mem_Copy(str, root_path.buffer, root_path.length);
|
Mem_Copy(str, root_path.buffer, root_path.length);
|
||||||
@ -439,9 +441,33 @@ cc_result Socket_CheckWritable(cc_socket s, cc_bool* writable) {
|
|||||||
/*########################################################################################################################*
|
/*########################################################################################################################*
|
||||||
*--------------------------------------------------------Platform---------------------------------------------------------*
|
*--------------------------------------------------------Platform---------------------------------------------------------*
|
||||||
*#########################################################################################################################*/
|
*#########################################################################################################################*/
|
||||||
|
static kos_blockdev_t sd_dev;
|
||||||
|
static uint8 partition_type;
|
||||||
|
|
||||||
|
static void InitSDCard(void) {
|
||||||
|
if (sd_init()) {
|
||||||
|
Platform_LogConst("Failed to init SD card"); return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (sd_blockdev_for_partition(0, &sd_dev, &partition_type)) {
|
||||||
|
Platform_LogConst("Unable to find first partition on SD card"); return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (fs_fat_init()) {
|
||||||
|
Platform_LogConst("Failed to init FAT filesystem"); return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (fs_fat_mount("/sd", &sd_dev, FS_FAT_MOUNT_READWRITE)) {
|
||||||
|
Platform_LogConst("Failed to mount SD card"); return;
|
||||||
|
}
|
||||||
|
|
||||||
|
root_path = String_FromReadonly("/sd/ClassiCube");
|
||||||
|
fs_mkdir("/sd/ClassiCube");
|
||||||
|
Platform_ReadonlyFilesystem = false;
|
||||||
|
}
|
||||||
|
|
||||||
static void InitModem(void) {
|
static void InitModem(void) {
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
Platform_LogConst("Trying to init modem..");
|
Platform_LogConst("Trying to init modem..");
|
||||||
|
|
||||||
if (!modem_init()) {
|
if (!modem_init()) {
|
||||||
@ -468,10 +494,8 @@ static void InitModem(void) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Platform_Init(void) {
|
void Platform_Init(void) {
|
||||||
char cwd[600] = { 0 };
|
|
||||||
char* ptr = getcwd(cwd, 600);
|
|
||||||
Platform_Log1("Working directory: %c", ptr);
|
|
||||||
Platform_ReadonlyFilesystem = true;
|
Platform_ReadonlyFilesystem = true;
|
||||||
|
InitSDCard();
|
||||||
|
|
||||||
if (net_default_dev) return;
|
if (net_default_dev) return;
|
||||||
// in case Broadband Adapter isn't active
|
// in case Broadband Adapter isn't active
|
||||||
|
Loading…
x
Reference in New Issue
Block a user