Skip to content
This repository was archived by the owner on Sep 29, 2025. It is now read-only.

Commit a5023fe

Browse files
authored
Merge pull request #1696 from reicast/skmp/bettter-bios-error
UI: Say where to put the bios when not found, cleanups
2 parents 5e0c940 + 13075a8 commit a5023fe

File tree

8 files changed

+19
-19
lines changed

8 files changed

+19
-19
lines changed

libswirl/hw/naomi/naomi_cart.cpp

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -53,11 +53,8 @@ static bool naomi_LoadBios(const char *filename, Archive *child_archive, Archive
5353

5454
struct BIOS_t *bios = &BIOS[biosid];
5555

56-
#if HOST_OS != OS_DARWIN
57-
std::string basepath = get_readonly_data_path("/data/");
58-
#else
59-
std::string basepath = get_readonly_data_path("/");
60-
#endif
56+
std::string basepath = get_readonly_data_path(DATA_PATH);
57+
6158
Archive *bios_archive = OpenArchive((basepath + filename).c_str());
6259

6360
bool found_region = false;

libswirl/hw/sh4/sh4_mem.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ void mem_Term()
215215
sh4_area0_Term();
216216

217217
//write back Flash/SRAM
218-
SaveRomFiles(get_writable_data_path("/data/"));
218+
SaveRomFiles(get_writable_data_path(DATA_PATH));
219219

220220
//mem_b.Term(); // handled by vmem
221221

libswirl/libswirl.cpp

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -302,12 +302,6 @@ int reicast_init(int argc, char* argv[])
302302
return 0;
303303
}
304304

305-
#if HOST_OS != OS_DARWIN
306-
#define DATA_PATH "/data/"
307-
#else
308-
#define DATA_PATH "/"
309-
#endif
310-
311305
bool game_started;
312306

313307
int dc_start_game(const char *path)
@@ -450,7 +444,7 @@ void* dc_run(void*)
450444

451445
sh4_cpu.Run();
452446

453-
SaveRomFiles(get_writable_data_path("/data/"));
447+
SaveRomFiles(get_writable_data_path(DATA_PATH));
454448
if (reset_requested)
455449
{
456450
dc_reset();
@@ -838,7 +832,7 @@ static string get_savestate_file_path()
838832
if (lastindex != -1)
839833
state_file = state_file.substr(0, lastindex);
840834
state_file = state_file + ".state";
841-
return get_writable_data_path("/data/") + state_file;
835+
return get_writable_data_path(DATA_PATH) + state_file;
842836
}
843837

844838
void dc_savestate()

libswirl/rend/gles/CustomTexture.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ bool CustomTexture::Init()
103103
std::string game_id = GetGameId();
104104
if (game_id.length() > 0)
105105
{
106-
textures_path = get_readonly_data_path("/data/") + "textures/" + game_id + "/";
106+
textures_path = get_readonly_data_path(DATA_PATH) + "textures/" + game_id + "/";
107107

108108
DIR *dir = opendir(textures_path.c_str());
109109
if (dir != NULL)
@@ -166,7 +166,7 @@ void CustomTexture::LoadCustomTextureAsync(TextureCacheData *texture_data)
166166

167167
void CustomTexture::DumpTexture(u32 hash, int w, int h, GLuint textype, void *temp_tex_buffer)
168168
{
169-
std::string base_dump_dir = get_writable_data_path("/data/texdump/");
169+
std::string base_dump_dir = get_writable_data_path(DATA_PATH "texdump/");
170170
if (!file_exists(base_dump_dir))
171171
make_directory(base_dump_dir);
172172
std::string game_id = GetGameId();

libswirl/rend/gles/glesrend.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -750,7 +750,7 @@ void gl_load_osd_resources()
750750
#ifdef _ANDROID
751751
int w, h;
752752
if (osd_tex == 0)
753-
osd_tex = loadPNG(get_readonly_data_path("/data/buttons.png"), w, h);
753+
osd_tex = loadPNG(get_readonly_data_path(DATA_PATH "buttons.png"), w, h);
754754
#endif
755755
}
756756

libswirl/rend/gui.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1443,6 +1443,9 @@ static void gui_display_demo()
14431443

14441444
static void gui_start_game(const std::string& path)
14451445
{
1446+
1447+
auto bios_path = get_readonly_data_path(DATA_PATH);
1448+
14461449
int rc = dc_start_game(path.empty() ? NULL : path.c_str());
14471450
if (rc != 0)
14481451
{
@@ -1454,7 +1457,7 @@ static void gui_start_game(const std::string& path)
14541457
error_msg = "Audio/video initialization failed";
14551458
break;
14561459
case -5:
1457-
error_msg = "Cannot find BIOS files";
1460+
error_msg = "Please put Dreamcast BIOS in " + bios_path;
14581461
break;
14591462
case -6:
14601463
error_msg = "Cannot load NAOMI rom or BIOS";

libswirl/stdclass.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ string get_game_save_prefix()
120120
#endif
121121
if (lastindex != -1)
122122
save_file = save_file.substr(lastindex + 1);
123-
return get_writable_data_path("/data/") + save_file;
123+
return get_writable_data_path(DATA_PATH) + save_file;
124124
}
125125

126126
string get_game_basename()

libswirl/stdclass.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,12 @@ class Array
154154
}
155155
};
156156

157+
#if HOST_OS != OS_DARWIN
158+
#define DATA_PATH "/data/"
159+
#else
160+
#define DATA_PATH "/"
161+
#endif
162+
157163
//Set the path !
158164
void set_user_config_dir(const string& dir);
159165
void set_user_data_dir(const string& dir);

0 commit comments

Comments
 (0)