Skip to content

Commit 85eae75

Browse files
committed
Hide u8string casts in macro
1 parent a2c9ec8 commit 85eae75

51 files changed

Lines changed: 256 additions & 247 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

Descent3/LoadLevel.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3620,7 +3620,7 @@ bool LoadLevelInfo(const std::filesystem::path &filename, level_info &info) {
36203620
bool found = false;
36213621

36223622
if (!ifile) {
3623-
LOG_ERROR.printf("Failed to open mission file %s", filename.u8string().c_str());
3623+
LOG_ERROR.printf("Failed to open mission file %s", PATH_TO_CSTR(filename));
36243624
return false;
36253625
}
36263626

Descent3/Mission.cpp

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -701,12 +701,12 @@ bool mn3_GetInfo(const std::filesystem::path &mn3file, tMissionInfo *msn);
701701

702702
static inline bool IS_MN3_FILE(const std::filesystem::path &fname) {
703703
std::filesystem::path ext = fname.extension();
704-
return (stricmp((const char*)ext.u8string().c_str(), ".mn3") == 0);
704+
return stricmp(PATH_TO_CSTR(ext), ".mn3") == 0;
705705
}
706706

707707
static inline std::filesystem::path MN3_TO_MSN_NAME(const std::filesystem::path &mn3name) {
708708
std::filesystem::path fname = std::filesystem::path(mn3name).stem();
709-
if (stricmp((const char*)fname.u8string().c_str(), "d3_2") == 0) {
709+
if (stricmp(PATH_TO_CSTR(fname), "d3_2") == 0) {
710710
fname = "d3";
711711
}
712712
fname.replace_extension(".msn");
@@ -1166,9 +1166,9 @@ bool LoadMission(const char *mssn) {
11661166
// set up current mission (movies are already set above)
11671167
msn->cur_level = 1;
11681168
msn->num_levels = numlevels;
1169-
msn->filename = mem_strdup((const char*)mission.u8string().c_str());
1169+
msn->filename = mem_strdup(PATH_TO_CSTR(mission));
11701170
msn->game_state_flags = 0;
1171-
strcpy(Net_msn_URLs.msnname, (const char*)mission.u8string().c_str());
1171+
strcpy(Net_msn_URLs.msnname, PATH_TO_CSTR(mission));
11721172
res = true; // everything is ok.
11731173

11741174
// if error, print it out, else end.
@@ -1238,7 +1238,7 @@ void LoadLevelText(const std::filesystem::path &level_filename) {
12381238
pathname.replace_extension(".str");
12391239

12401240
char **goal_strings;
1241-
if (CreateStringTable((const char*)pathname.u8string().c_str(), &goal_strings, &n_strings)) {
1241+
if (CreateStringTable(PATH_TO_CSTR(pathname), &goal_strings, &n_strings)) {
12421242
int n_goals = Level_goals.GetNumGoals();
12431243
ASSERT(n_strings == (n_goals * 3));
12441244
for (int i = 0; i < n_goals; i++) {
@@ -1692,7 +1692,7 @@ bool GetMissionInfo(const std::filesystem::path &msnfile, tMissionInfo *msn) {
16921692
}
16931693
CFILE *fp = cfopen(msnfile, "rt");
16941694
if (!fp) {
1695-
LOG_WARNING.printf("Failed to open mission file %s in GetMissionInfo.", msnfile.u8string().c_str());
1695+
LOG_WARNING.printf("Failed to open mission file %s in GetMissionInfo.", PATH_TO_CSTR(msnfile));
16961696
return false;
16971697
}
16981698
msn->multi = true;
@@ -1791,17 +1791,17 @@ bool mn3_Open(const std::filesystem::path &mn3file) {
17911791
std::filesystem::path filename = mn3file.stem();
17921792

17931793
std::filesystem::path voice_hog;
1794-
if ((stricmp((const char*)filename.u8string().c_str(), "d3") == 0) || (stricmp((const char*)filename.u8string().c_str(), "training") == 0)) {
1794+
if (stricmp(PATH_TO_CSTR(filename), "d3") == 0 || stricmp(PATH_TO_CSTR(filename), "training") == 0) {
17951795
// Open audio hog file
17961796
voice_hog = std::filesystem::path("missions") / "d3voice1.hog"; // Audio for levels 1-4
17971797
Mission_voice_hog_handle = cf_OpenLibrary(voice_hog);
1798-
} else if (stricmp((const char*)filename.u8string().c_str(), "d3_2") == 0) {
1798+
} else if (stricmp(PATH_TO_CSTR(filename), "d3_2") == 0) {
17991799
// Open audio hog file
18001800
voice_hog = std::filesystem::path("missions") / "d3voice2.hog"; // Audio for levels 5-17
18011801
Mission_voice_hog_handle = cf_OpenLibrary(voice_hog);
18021802
}
18031803
filename.replace_extension(".gam");
1804-
mng_SetAddonTable((const char*)filename.u8string().c_str());
1804+
mng_SetAddonTable(PATH_TO_CSTR(filename));
18051805
Current_mission.mn3_handle = mn3_handle;
18061806
return true;
18071807
}

Descent3/OsirisLoadandBind.cpp

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -778,7 +778,7 @@ int Osiris_FindLoadedModule(const std::filesystem::path &module_name) {
778778
for (int i = 0; i < MAX_LOADED_MODULES; i++) {
779779
if (OSIRIS_loaded_modules[i].flags & OSIMF_INUSE) {
780780
if (OSIRIS_loaded_modules[i].module_name &&
781-
(stricmp(OSIRIS_loaded_modules[i].module_name, (const char*)real_name.u8string().c_str()) == 0)) {
781+
stricmp(OSIRIS_loaded_modules[i].module_name, PATH_TO_CSTR(real_name)) == 0) {
782782
// we found a match
783783
return i;
784784
}
@@ -890,7 +890,7 @@ int get_full_path_to_module(const std::filesystem::path &module_name, std::files
890890
adjusted_fname = module_name.filename();
891891

892892
// make sure filename/ext is all lowercase, requirement for Linux, doesn't hurt Windows
893-
std::string p = (const char*)adjusted_fname.u8string().c_str();
893+
std::string p = PATH_TO_CSTR(adjusted_fname);
894894
std::transform(p.begin(), p.end(), p.begin(), [](unsigned char c) { return std::tolower(c); });
895895
adjusted_fname = p;
896896

@@ -958,7 +958,7 @@ int Osiris_LoadLevelModule(const std::filesystem::path &module_name) {
958958
// the module is already loaded
959959
OSIRIS_loaded_modules[loaded_id].reference_count++;
960960
LOG_DEBUG_IF(Show_osiris_debug)
961-
.printf("OSIRIS: Level Module (%s) reference count increased to %d", module_name.u8string().c_str(),
961+
.printf("OSIRIS: Level Module (%s) reference count increased to %d", PATH_TO_CSTR(module_name),
962962
OSIRIS_loaded_modules[loaded_id].reference_count);
963963
return loaded_id;
964964
}
@@ -973,7 +973,7 @@ int Osiris_LoadLevelModule(const std::filesystem::path &module_name) {
973973

974974
if (loaded_id >= MAX_LOADED_MODULES) {
975975
// no slots available
976-
LOG_FATAL.printf("OSIRIS: Osiris_LoadLevelModule(%s): No available slots\n", module_name.u8string().c_str());
976+
LOG_FATAL.printf("OSIRIS: Osiris_LoadLevelModule(%s): No available slots\n", PATH_TO_CSTR(module_name));
977977
Int3();
978978
return -4;
979979
}
@@ -985,16 +985,16 @@ int Osiris_LoadLevelModule(const std::filesystem::path &module_name) {
985985
switch (ret_val) {
986986
case -2:
987987
// the module does not exist
988-
LOG_ERROR.printf("OSIRIS: Osiris_LoadLevelModule(%s): Module doesn't exist", module_name.u8string().c_str());
988+
LOG_ERROR.printf("OSIRIS: Osiris_LoadLevelModule(%s): Module doesn't exist", PATH_TO_CSTR(module_name));
989989
return -1;
990990
break;
991991
case -1:
992992
// the module is in data\scripts
993993
break;
994994
default:
995995
// the module was an extracted file
996-
LOG_DEBUG.printf("OSIRIS: Found module (%s) in a temp file (%s)", basename.u8string().c_str(),
997-
fullpath.u8string().c_str());
996+
LOG_DEBUG.printf("OSIRIS: Found module (%s) in a temp file (%s)", PATH_TO_CSTR(basename),
997+
PATH_TO_CSTR(fullpath));
998998
OSIRIS_loaded_modules[loaded_id].flags |= OSIMF_INTEMPDIR;
999999
OSIRIS_loaded_modules[loaded_id].extracted_id = ret_val;
10001000
break;
@@ -1003,7 +1003,7 @@ int Osiris_LoadLevelModule(const std::filesystem::path &module_name) {
10031003
// the module exists, now attempt to load it
10041004
if (!mod_LoadModule(&OSIRIS_loaded_modules[loaded_id].mod, fullpath)) {
10051005
// there was an error trying to load the module
1006-
LOG_FATAL.printf("OSIRIS: Osiris_LoadLevelModule(%s): Unable to load module", module_name.u8string().c_str());
1006+
LOG_FATAL.printf("OSIRIS: Osiris_LoadLevelModule(%s): Unable to load module", PATH_TO_CSTR(module_name));
10071007
Int3();
10081008
return -3;
10091009
}
@@ -1034,7 +1034,7 @@ int Osiris_LoadLevelModule(const std::filesystem::path &module_name) {
10341034
osm->SaveRestoreState = (SaveRestoreState_fp)mod_GetSymbol(mod, "SaveRestoreState", 8);
10351035

10361036
osm->flags |= OSIMF_INUSE | OSIMF_LEVEL;
1037-
osm->module_name = mem_strdup((const char*)basename.u8string().c_str());
1037+
osm->module_name = mem_strdup(PATH_TO_CSTR(basename));
10381038
osm->reference_count = 1;
10391039

10401040
#ifdef OSIRISDEBUG
@@ -1047,7 +1047,7 @@ int Osiris_LoadLevelModule(const std::filesystem::path &module_name) {
10471047
!osm->GetCOScriptList || !osm->CreateInstance || !osm->DestroyInstance || !osm->SaveRestoreState ||
10481048
!osm->CallInstanceEvent) {
10491049
// there was an error importing a function
1050-
LOG_ERROR.printf("OSIRIS: Osiris_LoadLevelModule(%s) couldn't import function.", (const char*)module_name.u8string().c_str());
1050+
LOG_ERROR.printf("OSIRIS: Osiris_LoadLevelModule(%s) couldn't import function.", PATH_TO_CSTR(module_name));
10511051
Int3();
10521052
osm->flags = 0;
10531053
if (osm->module_name)
@@ -1059,15 +1059,15 @@ int Osiris_LoadLevelModule(const std::filesystem::path &module_name) {
10591059

10601060
// check to see if there is a corresponding string table to load
10611061
char stringtablename[_MAX_PATH];
1062-
strcpy(stringtablename, (const char*)basename.u8string().c_str());
1062+
strcpy(stringtablename, PATH_TO_CSTR(basename));
10631063
strcat(stringtablename, ".str");
10641064

10651065
if (cfexist(stringtablename)) {
10661066
// there is a string table, load it up
10671067
bool ret = CreateStringTable(stringtablename, &osm->string_table, &osm->strings_loaded);
10681068
if (!ret) {
10691069
LOG_ERROR.printf("OSIRIS: Unable to load string table (%s) for (%s)", stringtablename,
1070-
basename.u8string().c_str());
1070+
PATH_TO_CSTR(basename));
10711071
Int3();
10721072
osm->string_table = NULL;
10731073
osm->strings_loaded = 0;
@@ -1086,7 +1086,7 @@ int Osiris_LoadLevelModule(const std::filesystem::path &module_name) {
10861086
// when we get to this point we nearly have a loaded module, we just need to initialize it
10871087
if (!osm->InitializeDLL(&Osiris_module_init)) {
10881088
// there was an error initializing the module
1089-
LOG_ERROR.printf("OSIRIS: Osiris_LoadLevelModule(%s) error initializing module.", basename.u8string().c_str());
1089+
LOG_ERROR.printf("OSIRIS: Osiris_LoadLevelModule(%s) error initializing module.", PATH_TO_CSTR(basename));
10901090
if (osm->string_table) {
10911091
DestroyStringTable(osm->string_table, osm->strings_loaded);
10921092
}
@@ -1129,7 +1129,7 @@ int Osiris_LoadLevelModule(const std::filesystem::path &module_name) {
11291129
tOSIRISCurrentLevel.instance =
11301130
OSIRIS_loaded_modules[loaded_id].CreateInstance(0); // level scripts always have id of 0 in a level dll
11311131

1132-
LOG_INFO.printf("OSIRIS: Level Module (%s) loaded successfully (%d custom handles)", basename.u8string().c_str(),
1132+
LOG_INFO.printf("OSIRIS: Level Module (%s) loaded successfully (%d custom handles)", PATH_TO_CSTR(basename),
11331133
tOSIRISCurrentLevel.num_customs);
11341134
Osiris_level_script_loaded = true;
11351135
return loaded_id;
@@ -1153,7 +1153,7 @@ int Osiris_LoadGameModule(const std::filesystem::path &module_name) {
11531153
// the module is already loaded
11541154
OSIRIS_loaded_modules[loaded_id].reference_count++;
11551155
if (Show_osiris_debug) {
1156-
LOG_DEBUG.printf("OSIRIS: Game Module (%s) reference count increased to %d", module_name.u8string().c_str(),
1156+
LOG_DEBUG.printf("OSIRIS: Game Module (%s) reference count increased to %d", PATH_TO_CSTR(module_name),
11571157
OSIRIS_loaded_modules[loaded_id].reference_count);
11581158
}
11591159
return loaded_id;
@@ -1169,7 +1169,7 @@ int Osiris_LoadGameModule(const std::filesystem::path &module_name) {
11691169

11701170
if (loaded_id >= MAX_LOADED_MODULES) {
11711171
// no slots available
1172-
LOG_FATAL.printf("OSIRIS: Osiris_LoadGameModule(%s): No available slots", module_name.u8string().c_str());
1172+
LOG_FATAL.printf("OSIRIS: Osiris_LoadGameModule(%s): No available slots", PATH_TO_CSTR(module_name));
11731173
Int3();
11741174
return -4;
11751175
}
@@ -1181,15 +1181,15 @@ int Osiris_LoadGameModule(const std::filesystem::path &module_name) {
11811181
switch (ret_val) {
11821182
case -2:
11831183
// the module does not exist
1184-
LOG_WARNING.printf("OSIRIS: Osiris_LoadLevelModule(%s): Module doesn't exist", module_name.u8string().c_str());
1184+
LOG_WARNING.printf("OSIRIS: Osiris_LoadLevelModule(%s): Module doesn't exist", PATH_TO_CSTR(module_name));
11851185
return -1;
11861186
break;
11871187
case -1:
11881188
// the module is in data\scripts
11891189
break;
11901190
default:
11911191
// the module was an extracted file
1192-
LOG_INFO.printf("OSIRIS: Found module (%s) in a temp file", basename.u8string().c_str());
1192+
LOG_INFO.printf("OSIRIS: Found module (%s) in a temp file", PATH_TO_CSTR(basename));
11931193
OSIRIS_loaded_modules[loaded_id].flags |= OSIMF_INTEMPDIR;
11941194
OSIRIS_loaded_modules[loaded_id].extracted_id = ret_val;
11951195
break;
@@ -1198,7 +1198,7 @@ int Osiris_LoadGameModule(const std::filesystem::path &module_name) {
11981198
// the module exists, now attempt to load it
11991199
if (!mod_LoadModule(&OSIRIS_loaded_modules[loaded_id].mod, fullpath)) {
12001200
// there was an error trying to load the module
1201-
LOG_FATAL.printf("OSIRIS: Osiris_LoadGameModule(%s): Unable to load module", module_name.u8string().c_str());
1201+
LOG_FATAL.printf("OSIRIS: Osiris_LoadGameModule(%s): Unable to load module", PATH_TO_CSTR(module_name));
12021202
Int3();
12031203
return -3;
12041204
}
@@ -1227,7 +1227,7 @@ int Osiris_LoadGameModule(const std::filesystem::path &module_name) {
12271227
osm->SaveRestoreState = (SaveRestoreState_fp)mod_GetSymbol(mod, "SaveRestoreState", 8);
12281228

12291229
osm->flags |= OSIMF_INUSE;
1230-
osm->module_name = mem_strdup((const char*)basename.u8string().c_str());
1230+
osm->module_name = mem_strdup(PATH_TO_CSTR(basename));
12311231
osm->reference_count = 1;
12321232

12331233
#ifdef OSIRISDEBUG
@@ -1239,7 +1239,7 @@ int Osiris_LoadGameModule(const std::filesystem::path &module_name) {
12391239
if (!osm->InitializeDLL || !osm->ShutdownDLL || !osm->GetGOScriptID || !osm->CreateInstance ||
12401240
!osm->DestroyInstance || !osm->SaveRestoreState || !osm->CallInstanceEvent) {
12411241
// there was an error importing a function
1242-
LOG_WARNING.printf("OSIRIS: Osiris_LoadGameModule(%s) couldn't import function.", basename.u8string().c_str());
1242+
LOG_WARNING.printf("OSIRIS: Osiris_LoadGameModule(%s) couldn't import function.", PATH_TO_CSTR(basename));
12431243
Int3();
12441244
osm->flags = 0;
12451245
if (osm->module_name)
@@ -1251,15 +1251,15 @@ int Osiris_LoadGameModule(const std::filesystem::path &module_name) {
12511251

12521252
// check to see if there is a corresponding string table to load
12531253
char stringtablename[_MAX_PATH];
1254-
strcpy(stringtablename, (const char*)basename.u8string().c_str());
1254+
strcpy(stringtablename, PATH_TO_CSTR(basename));
12551255
strcat(stringtablename, ".str");
12561256

12571257
if (cfexist(stringtablename)) {
12581258
// there is a string table, load it up
12591259
bool ret = CreateStringTable(stringtablename, &osm->string_table, &osm->strings_loaded);
12601260
if (!ret) {
12611261
LOG_FATAL.printf("OSIRIS: Unable to load string table (%s) for (%s)", stringtablename,
1262-
(const char*)basename.u8string().c_str());
1262+
PATH_TO_CSTR(basename));
12631263
Int3();
12641264
osm->string_table = nullptr;
12651265
osm->strings_loaded = 0;
@@ -1277,7 +1277,7 @@ int Osiris_LoadGameModule(const std::filesystem::path &module_name) {
12771277
// when we get to this point we nearly have a loaded module, we just need to initialize it
12781278
if (!osm->InitializeDLL(&Osiris_module_init)) {
12791279
// there was an error initializing the module
1280-
LOG_ERROR.printf("OSIRIS: Osiris_LoadGameModule(%s) error initializing module.", (const char*)basename.u8string().c_str());
1280+
LOG_ERROR.printf("OSIRIS: Osiris_LoadGameModule(%s) error initializing module.", PATH_TO_CSTR(basename));
12811281
if (osm->string_table) {
12821282
DestroyStringTable(osm->string_table, osm->strings_loaded);
12831283
}
@@ -1298,7 +1298,7 @@ int Osiris_LoadGameModule(const std::filesystem::path &module_name) {
12981298
}
12991299

13001300
// we have a successful module load
1301-
LOG_INFO.printf("OSIRIS: Game Module (%s) loaded successfully", basename.u8string().c_str());
1301+
LOG_INFO.printf("OSIRIS: Game Module (%s) loaded successfully", PATH_TO_CSTR(basename));
13021302
return loaded_id;
13031303
}
13041304

@@ -3120,7 +3120,7 @@ int Osiris_ExtractScriptsFromHog(int library_handle, bool is_mission_hog) {
31203120
if (temp_filename.empty()) {
31213121
Int3();
31223122
} else {
3123-
std::string temp_realname = (const char*)std::filesystem::path(filename).stem().u8string().c_str();
3123+
std::string temp_realname = PATH_TO_CSTR(std::filesystem::path(filename).stem());
31243124
// Lowercase for optimized search
31253125
std::transform(temp_realname.begin(), temp_realname.end(), temp_realname.begin(),
31263126
[](unsigned char c) { return std::tolower(c); });
@@ -3135,7 +3135,7 @@ int Osiris_ExtractScriptsFromHog(int library_handle, bool is_mission_hog) {
31353135
t.temp_filename = temp_filename.filename();
31363136
OSIRIS_Extracted_scripts.insert_or_assign(temp_realname, t);
31373137

3138-
LOG_DEBUG.printf("Extracted %s as %s", temp_realname.c_str(), temp_filename.u8string().c_str());
3138+
LOG_DEBUG.printf("Extracted %s as %s", temp_realname.c_str(), PATH_TO_CSTR(temp_filename));
31393139
} else {
31403140
LOG_DEBUG.printf("Skipped %s (already extracted)", temp_realname.c_str());
31413141
}

Descent3/ambient.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,7 @@ void WriteAmbientData() {
294294
CFILE *ofile;
295295

296296
#ifndef NEWEDITOR
297-
ddio_MakePath(filename, (const char*)cf_GetWritableBaseDirectory().u8string().c_str(), "data", "misc", AMBIENT_FILE_NAME, NULL);
297+
ddio_MakePath(filename, PATH_TO_CSTR(cf_GetWritableBaseDirectory()), "data", "misc", AMBIENT_FILE_NAME, NULL);
298298
#else
299299
ddio_MakePath(filename, D3HogDir, "data", "misc", AMBIENT_FILE_NAME, NULL);
300300
#endif

Descent3/audiotaunts.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ bool taunt_PlayPlayerTaunt(int pnum, int index) {
133133
fullpath = LocalCustomSoundsDir / file;
134134

135135
if (!cfexist(fullpath)) {
136-
LOG_WARNING.printf("TAUNT: file %s doesn't exist (pnum=%d)", fullpath.u8string().c_str(), pnum);
136+
LOG_WARNING.printf("TAUNT: file %s doesn't exist (pnum=%d)", PATH_TO_CSTR(fullpath), pnum);
137137
return false;
138138
}
139139

@@ -354,7 +354,7 @@ bool taunt_ImportWave(const char *wave_filename, const char *outputfilename) {
354354
goto error;
355355
}
356356

357-
if (!aenc_Compress((const char*)temp_filename.u8string().c_str(), (const char*)osftemp_filename.u8string().c_str(), NULL, &samples, &rate, &chan, NULL, NULL)) {
357+
if (!aenc_Compress(PATH_TO_CSTR(temp_filename), PATH_TO_CSTR(osftemp_filename), NULL, &samples, &rate, &chan, NULL, NULL)) {
358358
// unable to compress
359359
LOG_WARNING << "Unable to compress";
360360
ret = false;

Descent3/cinematics.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ bool PlayMovie(const std::filesystem::path &moviename) {
7272
std::filesystem::path filename = moviename;
7373
// check extension
7474
std::filesystem::path extension = moviename.extension();
75-
if (stricmp((const char*)extension.u8string().c_str(), ".mve") != 0 && stricmp((const char*)extension.u8string().c_str(), ".mv8") != 0) {
75+
if (stricmp(PATH_TO_CSTR(extension), ".mve") != 0 && stricmp(PATH_TO_CSTR(extension), ".mv8") != 0) {
7676
// we need an extension
7777
filename.replace_extension(".mve");
7878
}

Descent3/d3movie.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ int mve_PlayMovie(const std::filesystem::path &pMovieName, oeApplication *pApp)
8181
return MVELIB_FILE_ERROR;
8282
}
8383
// open movie file.
84-
FILE *hFile = fopen((const char*)real_name.u8string().c_str(), "rb");
84+
FILE *hFile = fopen(PATH_TO_CSTR(real_name), "rb");
8585
if (hFile == nullptr) {
8686
LOG_ERROR << "MOVIE: Unable to open " << pMovieName;
8787
return MVELIB_FILE_ERROR;
@@ -103,7 +103,7 @@ int mve_PlayMovie(const std::filesystem::path &pMovieName, oeApplication *pApp)
103103

104104
MVESTREAM *mve = MVE_rmPrepMovie(hFile, -1, -1, 0);
105105
if (mve == nullptr) {
106-
LOG_ERROR.printf("Failed to prepMovie %s", pMovieName.u8string().c_str());
106+
LOG_ERROR.printf("Failed to prepMovie %s", PATH_TO_CSTR(pMovieName));
107107
fclose(hFile);
108108
mve_CloseSound();
109109
return MVELIB_INIT_ERROR;
@@ -323,10 +323,10 @@ intptr_t mve_SequenceStart(const char *mvename, void *fhandle, oeApplication *ap
323323
#ifndef NO_MOVIES
324324
// first, find that movie..
325325
std::filesystem::path real_name = cf_LocatePath(std::filesystem::path("movies") / mvename);
326-
fhandle = fopen((const char*)real_name.u8string().c_str(), "rb");
326+
fhandle = fopen(PATH_TO_CSTR(real_name), "rb");
327327

328328
if (fhandle == nullptr) {
329-
LOG_WARNING.printf("MOVIE: Unable to open %s", (const char*)real_name.u8string().c_str());
329+
LOG_WARNING.printf("MOVIE: Unable to open %s", PATH_TO_CSTR(real_name));
330330
return 0;
331331
}
332332

Descent3/dedicated_server.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -336,7 +336,7 @@ int LoadServerConfigFile() {
336336

337337
// open file
338338
if (!inf.Open(Netgame.server_config_name, "[server config file]", DedicatedServerLex)) {
339-
PrintDedicatedMessage(TXT_DS_BADCONFIG, Netgame.server_config_name.u8string().c_str());
339+
PrintDedicatedMessage(TXT_DS_BADCONFIG, PATH_TO_CSTR(Netgame.server_config_name));
340340
PrintDedicatedMessage("\n");
341341
return 0;
342342
}

0 commit comments

Comments
 (0)