Skip to content

Commit c47c202

Browse files
authored
[CMAKE] Make WDump only depend on WWVegas (#682)
1 parent 9a530ac commit c47c202

File tree

5 files changed

+142
-3
lines changed

5 files changed

+142
-3
lines changed

Core/Libraries/Source/WWVegas/CMakeLists.txt

+1
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ add_subdirectory(WWLib)
2626
# add_subdirectory(WWMath)
2727
# add_subdirectory(Wwutil)
2828
# add_subdirectory(WWSaveLoad)
29+
add_subdirectory(WWStub)
2930
# add_subdirectory(WW3D2)
3031
# add_subdirectory(WWDownload)
3132
# add_subdirectory(wwshade)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# Set source files
2+
set(WWSTUB_SRC
3+
wwallocstub.cpp
4+
wwdebugstub.cpp
5+
)
6+
7+
# Targets to build.
8+
add_library(core_wwstub STATIC)
9+
set_target_properties(core_wwstub PROPERTIES OUTPUT_NAME wwstub)
10+
11+
target_sources(core_wwstub PRIVATE ${WWSTUB_SRC})
12+
13+
target_link_libraries(core_wwstub PRIVATE
14+
core_wwcommon
15+
corei_always
16+
)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
/*
2+
** Command & Conquer Generals Zero Hour(tm)
3+
** Copyright 2025 TheSuperHackers
4+
**
5+
** This program is free software: you can redistribute it and/or modify
6+
** it under the terms of the GNU General Public License as published by
7+
** the Free Software Foundation, either version 3 of the License, or
8+
** (at your option) any later version.
9+
**
10+
** This program is distributed in the hope that it will be useful,
11+
** but WITHOUT ANY WARRANTY; without even the implied warranty of
12+
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13+
** GNU General Public License for more details.
14+
**
15+
** You should have received a copy of the GNU General Public License
16+
** along with this program. If not, see <http://www.gnu.org/licenses/>.
17+
*/
18+
19+
// TheSuperHackers @compile feliwir 15/04/2025 Simple allocator implementation useful for tools
20+
#include "always.h"
21+
#include <stdlib.h>
22+
23+
#ifdef _OPERATOR_NEW_DEFINED_
24+
25+
void *operator new(size_t size)
26+
{
27+
return malloc(size);
28+
}
29+
30+
void *operator new[](size_t size)
31+
{
32+
return malloc(size);
33+
}
34+
35+
void operator delete(void *p)
36+
{
37+
free(p);
38+
}
39+
40+
void operator delete[](void *p)
41+
{
42+
free(p);
43+
}
44+
45+
void* operator new(size_t size, const char * fname, int)
46+
{
47+
return malloc(size);
48+
}
49+
50+
void operator delete(void * p, const char *, int)
51+
{
52+
free(p);
53+
}
54+
55+
void* operator new[](size_t size, const char * fname, int)
56+
{
57+
return malloc(size);
58+
}
59+
60+
void operator delete[](void * p, const char *, int)
61+
{
62+
free(p);
63+
}
64+
65+
#endif
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
/*
2+
** Command & Conquer Generals Zero Hour(tm)
3+
** Copyright 2025 TheSuperHackers
4+
**
5+
** This program is free software: you can redistribute it and/or modify
6+
** it under the terms of the GNU General Public License as published by
7+
** the Free Software Foundation, either version 3 of the License, or
8+
** (at your option) any later version.
9+
**
10+
** This program is distributed in the hope that it will be useful,
11+
** but WITHOUT ANY WARRANTY; without even the implied warranty of
12+
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13+
** GNU General Public License for more details.
14+
**
15+
** You should have received a copy of the GNU General Public License
16+
** along with this program. If not, see <http://www.gnu.org/licenses/>.
17+
*/
18+
19+
// TheSuperHackers @compile feliwir 15/04/2025 Simple debug implementation useful for tools
20+
#include "wwdebug.h"
21+
#include <stdarg.h>
22+
#include <stdlib.h>
23+
#include <stdio.h>
24+
25+
char* TheCurrentIgnoreCrashPtr = NULL;
26+
27+
28+
#ifdef DEBUG_LOGGING
29+
30+
void DebugLog(const char *format, ...)
31+
{
32+
// Print it to the console
33+
char theBuffer[8192];
34+
35+
va_list arg;
36+
va_start(arg, format);
37+
vsprintf(theBuffer, format, arg);
38+
va_end(arg);
39+
}
40+
41+
#endif
42+
43+
#ifdef DEBUG_CRASHING
44+
45+
void DebugCrash(const char *format, ...)
46+
{
47+
// Print it to the console
48+
char theCrashBuffer[8192];
49+
va_list arg;
50+
va_start(arg, format);
51+
vsprintf(theCrashBuffer, format, arg);
52+
va_end(arg);
53+
54+
// Quit
55+
exit(EXIT_FAILURE);
56+
}
57+
58+
#endif

GeneralsMD/Code/Tools/wdump/CMakeLists.txt

+2-3
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,8 @@ target_link_libraries(z_wdump PRIVATE
2222
imm32
2323
vfw32
2424
winmm
25-
z_debug
26-
z_gameengine
27-
z_gameenginedevice
25+
core_wwstub # avoid linking GameEngine
26+
z_wwvegas
2827
)
2928

3029
if(WIN32 OR "${CMAKE_SYSTEM}" MATCHES "Windows")

0 commit comments

Comments
 (0)