Skip to content

Commit 893e5f5

Browse files
committed
- what the fuck GCC
1 parent b16a67b commit 893e5f5

40 files changed

Lines changed: 128 additions & 183 deletions

.appveyor/Build.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ set -ex
33

44
cd "$APPVEYOR_BUILD_FOLDER"
55

6-
./premake5 gmake2
6+
./premake5 gmake2 verbose
77

88
for config in debug release
99
do

Driver2CutsceneTool/cutscene_tool.cpp

Lines changed: 20 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
1-
#include <math.h>
2-
1+
#include <stdlib.h>
2+
#include <stdio.h>
33
#include <malloc.h>
4-
#include "core/VirtualStream.h"
54
#include "core/cmdlib.h"
6-
#include "math/dktypes.h"
7-
#include "util/image.h"
8-
#include "util/util.h"
9-
#include <string>
5+
#include "core/dktypes.h"
6+
#include <string.h>
7+
#include <nstd/Directory.hpp>
8+
#include <nstd/File.hpp>
9+
#include <nstd/String.hpp>
1010

11-
#include <DriverLevelTool/driver_routines/d2_types.h>
11+
#include "math/psx_math_types.h"
1212

1313
#define MAX_FILE_CUTSCENES 15
1414
#define REPLAY_BUFFER_MINSIZE 2280
@@ -166,13 +166,10 @@ struct REPLAY_STREAM_HEADER
166166
void UnpackCutsceneFile(const char* filename)
167167
{
168168
// replace extension with .den
169-
std::string cut_name = filename;
170-
171-
size_t str_idx = cut_name.find_last_of(".");
172-
cut_name = cut_name.substr(0, str_idx);
169+
String cut_name = String::fromCString(filename);
170+
cut_name = File::basename(cut_name, File::extension(cut_name));
173171

174172
char* buffer;
175-
char folderPath[512];
176173

177174
CUTSCENE_HEADER header;
178175
FILE* fp = fopen(filename, "rb");
@@ -189,8 +186,8 @@ void UnpackCutsceneFile(const char* filename)
189186
Msg("Max replay buffer size: %d\n", header.maxsize);
190187

191188
// make the folder
192-
sprintf(folderPath, "%s", cut_name.c_str());
193-
mkdirRecursive(folderPath, true);
189+
String folderPath = cut_name;
190+
Directory::create(folderPath);
194191

195192
buffer = (char*)malloc(0x200000);
196193

@@ -236,9 +233,7 @@ void UnpackCutsceneFile(const char* filename)
236233
}
237234

238235
// save separate file
239-
sprintf(folderPath, "%s/%s_%d.D2RP", cut_name.c_str(), cut_name.c_str(), i);
240-
241-
FILE* wp = fopen(folderPath, "wb");
236+
FILE* wp = fopen(String::fromPrintf("%s/%s_%d.D2RP", (char*)cut_name, (char*)cut_name, i), "wb");
242237
if (wp)
243238
{
244239
MsgWarning("\tSaving '%s', at %d, %d bytes\n", folderPath, header.data[i].offset, header.data[i].size);
@@ -256,7 +251,6 @@ void PackCutsceneFile(const char* foldername)
256251
{
257252
int offset;
258253
char* buffer;
259-
char folderPath[512];
260254
CUTSCENE_HEADER header;
261255
header.maxsize = REPLAY_BUFFER_MINSIZE;
262256

@@ -269,8 +263,8 @@ void PackCutsceneFile(const char* foldername)
269263

270264
for (int i = 0; i < MAX_FILE_CUTSCENES; i++)
271265
{
272-
sprintf(folderPath, "%s/%s_%d.D2RP", foldername, foldername, i);
273-
FILE* fp = fopen(folderPath, "rb");
266+
String folderPath = String::fromPrintf("%s/%s_%d.D2RP", foldername, foldername, i);
267+
FILE* fp = fopen(String::fromPrintf("%s/%s_%d.D2RP", foldername, foldername, i), "rb");
274268
if (fp)
275269
{
276270
if (i == 0)
@@ -294,7 +288,7 @@ void PackCutsceneFile(const char* foldername)
294288
replays[i] = (char*)malloc(size);
295289
repsizes[i] = size;
296290

297-
MsgWarning("\tLoaded '%s', %d bytes\n", folderPath, size);
291+
MsgWarning("\tLoaded '%s', %d bytes\n", (char*)folderPath, size);
298292
fread(replays[i], 1, size, fp);
299293
fclose(fp);
300294

@@ -327,7 +321,7 @@ void PackCutsceneFile(const char* foldername)
327321

328322
// shrink size
329323
repsizes[i] -= sizeof(PLAYBACKCAMERA) * MAX_REPLAY_CAMERAS;
330-
MsgAccept("\tShrinking '%s', now %d bytes\n", folderPath, repsizes[i]);
324+
MsgAccept("\tShrinking '%s', now %d bytes\n", (char*)folderPath, repsizes[i]);
331325
}
332326
}
333327
else
@@ -359,15 +353,16 @@ void PackCutsceneFile(const char* foldername)
359353
MsgWarning("No chase replays\n");
360354
}
361355

362-
sprintf(folderPath, "%s_N.R", foldername);
356+
String folderPath = String::fromPrintf("%s_N.R", foldername);
357+
363358
FILE* wp = fopen(folderPath, "wb");
364359

365360
if (!wp)
366361
{
367362
for (int i = 0; i < MAX_FILE_CUTSCENES; i++)
368363
free(replays[i]);
369364

370-
MsgError("Unable to save '%s'\n", folderPath);
365+
MsgError("Unable to save '%s'\n", (char*)folderPath);
371366
return;
372367
}
373368

Driver2CutsceneTool/premake5.lua

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@ project "Driver2CutsceneTool"
77
targetdir "bin/%{cfg.buildcfg}"
88

99
-- framework link
10-
dependson { "frameworkLib" }
11-
links { "frameworkLib" }
10+
dependson { "frameworkLib", "libnstd" }
11+
links { "frameworkLib", "libnstd" }
1212
includedirs {
13-
"dependencies/libnstd/include",
13+
"../dependencies/libnstd/include",
1414
}
1515
--
1616

Driver2MissionTool/mission_tool.cpp

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,7 @@
1-
#include <math.h>
1+
#include <stdlib.h>
2+
#include <string.h>
23

3-
#include <malloc.h>
4-
#include "core/VirtualStream.h"
54
#include "core/cmdlib.h"
6-
#include "math/dktypes.h"
7-
#include "util/image.h"
8-
#include "util/util.h"
9-
#include <string>
10-
#include <DriverLevelTool/driver_routines/d2_types.h>
11-
125
//----------------------------------------------------
136

147
void CompileMissionBlk(const char* filename)

Driver2MissionTool/premake5.lua

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,13 @@
33
project "Driver2MissionTool"
44
kind "ConsoleApp"
55
language "C++"
6-
compileas "C++"
76
targetdir "bin/%{cfg.buildcfg}"
87

98
-- framework link
10-
dependson { "frameworkLib" }
11-
links { "frameworkLib" }
9+
dependson { "frameworkLib", "libnstd" }
10+
links { "frameworkLib", "libnstd" }
1211
includedirs {
13-
"dependencies/libnstd/include",
12+
"../dependencies/libnstd/include",
1413
}
1514
--
1615

DriverImageTool/image_tool.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,12 @@
33
#include <malloc.h>
44
#include "core/VirtualStream.h"
55
#include "core/cmdlib.h"
6-
#include "math/dktypes.h"
6+
#include "core/dktypes.h"
77
#include "util/image.h"
88
#include "util/util.h"
99

10+
#include <string.h>
11+
1012
struct RECT16
1113
{
1214
short x, y, w, h;

DriverImageTool/premake5.lua

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@ project "DriverImageTool"
77
targetdir "bin/%{cfg.buildcfg}"
88

99
-- framework link
10-
dependson { "frameworkLib" }
11-
links { "frameworkLib" }
10+
dependson { "frameworkLib", "libnstd" }
11+
links { "frameworkLib", "libnstd" }
1212
includedirs {
13-
"dependencies/libnstd/include",
13+
"../dependencies/libnstd/include",
1414
}
1515
--
1616

DriverLevelTool/driver_level.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
#include "driver_level.h"
2+
3+
#include <string.h>
4+
25
#include "core/cmdlib.h"
36
#include "core/VirtualStream.h"
47

DriverLevelTool/driver_routines/d2_types.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#ifndef D2_TYPES
22
#define D2_TYPES
33

4-
#include "math/dktypes.h"
4+
#include "core/dktypes.h"
55
#include "math/psx_math_types.h"
66

77
#define TEXPAGE_SIZE_X (128)

DriverLevelTool/driver_routines/level.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
#include "math/dktypes.h"
1+
#include "core/dktypes.h"
2+
#include "core/cmdlib.h"
23
#include "core/VirtualStream.h"
34

45
#include <nstd/String.hpp>
@@ -10,6 +11,7 @@
1011

1112
#include "level.h"
1213

14+
1315
//--------------------------------------------------------------------------------------------------------------------------
1416

1517
char* g_overlayMapData = nullptr;

0 commit comments

Comments
 (0)