Skip to content

Commit 37bf2e0

Browse files
Use RSTL_VERSION in rstl
1 parent 45ea240 commit 37bf2e0

9 files changed

Lines changed: 63 additions & 11 deletions

File tree

‎configure.py‎

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,17 @@
3939
"R3ME01_00", # mp-v3.593 Trilogy NTSC
4040
"R3MP01_00", # mp-v3.629 Trilogy PAL
4141
]
42+
RSTL_VERSIONS = {
43+
"GM8E01_00": 0,
44+
"GM8E01_01": 1,
45+
"GM8E01_48": 2,
46+
"GM8P01_00": 3,
47+
"GM8J01_00": 4,
48+
"GM8E01_02": 5,
49+
"R3IJ01_00": 30,
50+
"R3ME01_00": 40,
51+
"R3MP01_00": 41,
52+
}
4253

4354
DISABLED_VERSIONS = [
4455
# 1,
@@ -241,6 +252,7 @@
241252
"-i extern/sdk/libc",
242253
f"-i build/{config.version}/include",
243254
f"-DVERSION={version_num}",
255+
f"-DRSTL_VERSION={RSTL_VERSIONS[config.version]}",
244256
"-DPRIME1",
245257
"-DNONMATCHING=0",
246258
]
@@ -297,6 +309,7 @@
297309
"-i extern/sdk/libc",
298310
f"-i build/{config.version}/include",
299311
f"-DVERSION={version_num}",
312+
f"-DRSTL_VERSION={RSTL_VERSIONS[config.version]}",
300313
"-DPRIME1",
301314
"-DNONMATCHING=0",
302315
"-use_lmw_stmw on",
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
#ifndef _RSTL_VERSIONS_H
2+
#define _RSTL_VERSIONS_H
3+
4+
// Prime 1 GC
5+
#define RSTL_GM8E_00 0
6+
#define RSTL_GM8E_01 1
7+
#define RSTL_GM8E_48 2
8+
#define RSTL_GM8P_00 3
9+
#define RSTL_GM8J_00 4
10+
#define RSTL_GM8E_02 5
11+
12+
// Prime 2 GC
13+
#define RSTL_G2ME 10
14+
#define RSTL_G2MP 11
15+
#define RSTL_G2MJ 12
16+
17+
// Prime 3 Standalone
18+
#define RSTL_G2MEAB 20 // E3 2006 Prototype
19+
#define RSTL_RM3E 21
20+
#define RSTL_RM3P 22
21+
#define RSTL_RM3J 23
22+
23+
// Wii de Asobu
24+
#define RSTL_R3IJ 30
25+
#define RSTL_R32J 31
26+
27+
// Trilogy
28+
#define RSTL_R3ME_00 40
29+
#define RSTL_R3MP_00 41
30+
31+
#endif // _RSTL_VERSIONS_H

‎extern/rstl/include/rstl/allocator.hpp‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,18 @@
11
#ifndef _RSTL_RMEMORY_ALLOCATOR
22
#define _RSTL_RMEMORY_ALLOCATOR
33

4-
#include "GameVersions.h"
4+
#include "rstl/RstlVersions.h"
55
#include "types.h"
66

77
#include "Kyoto/Alloc/CMemory.hpp"
88

99
namespace rstl {
10+
1011
struct rmemory_allocator {
1112
rmemory_allocator() {}
1213
rmemory_allocator(const rmemory_allocator&) {}
1314

14-
#if defined(__MWERKS__) && (VERSION >= VERSION_GM8P_00) && VERSION != VERSION_GM8E_02
15+
#if defined(__MWERKS__) && (RSTL_VERSION >= RSTL_GM8P_00) && RSTL_VERSION != RSTL_GM8E_02
1516
static void* allocate(int size);
1617
#endif
1718

@@ -32,7 +33,7 @@ struct rmemory_allocator {
3233
}
3334
#endif
3435
#endif
35-
#if defined(__MWERKS__) && (VERSION >= VERSION_GM8P_00) && VERSION != VERSION_GM8E_02
36+
#if defined(__MWERKS__) && (RSTL_VERSION >= RSTL_GM8P_00) && RSTL_VERSION != RSTL_GM8E_02
3637
out = reinterpret_cast< T* >(allocate(size));
3738
#else
3839
if (size == 0) {

‎extern/rstl/include/rstl/construct.hpp‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#ifndef _RSTL_CONSTRUCT
22
#define _RSTL_CONSTRUCT
33

4+
#include "rstl/RstlVersions.h"
45
#include "types.h"
56

67
#include "Kyoto/Alloc/CMemory.hpp"
@@ -11,7 +12,7 @@ static inline void construct(void* dest, const T& src) {
1112
new (dest) T(src);
1213
}
1314

14-
#if VERSION >= VERSION_GM8P_00 && VERSION != VERSION_GM8E_02
15+
#if RSTL_VERSION >= RSTL_GM8P_00 && RSTL_VERSION != RSTL_GM8E_02
1516
template < typename T >
1617
static inline void destroy(T* const in) {
1718
#else

‎extern/rstl/include/rstl/list.hpp‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
#include "types.h"
55

6+
#include "rstl/RstlVersions.h"
67
#include "rstl/construct.hpp"
78
#include "rstl/functional.hpp"
89
#include "rstl/iterator.hpp"
@@ -134,7 +135,7 @@ class list {
134135
void insert(const iterator& pos, InputIterator first, InputIterator last);
135136

136137
void destroy() {
137-
#if VERSION >= VERSION_GM8P_00 && VERSION != VERSION_GM8E_02
138+
#if RSTL_VERSION >= RSTL_GM8P_00 && RSTL_VERSION != RSTL_GM8E_02
138139
clear();
139140
#else
140141
iterator last = end();

‎extern/rstl/include/rstl/optional_object.hpp‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
#include "types.h"
55

6+
#include "rstl/RstlVersions.h"
67
#include "rstl/construct.hpp"
78

89
namespace rstl {
@@ -20,7 +21,7 @@ class optional_object {
2021
}
2122
}
2223
~optional_object() {
23-
#if VERSION >= VERSION_GM8P_00 && VERSION != VERSION_GM8E_02
24+
#if RSTL_VERSION >= RSTL_GM8P_00 && RSTL_VERSION != RSTL_GM8E_02
2425
if (m_valid) {
2526
rstl::destroy(get_ptr());
2627
}

‎extern/rstl/include/rstl/set.hpp‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,10 @@
33

44
#include "types.h"
55

6+
#include "rstl/RstlVersions.h"
67
#include "rstl/red_black_tree.hpp"
78
#include "rstl/allocator.hpp"
9+
810
namespace rstl {
911
template < typename T, typename Cmp = less< T >, typename Alloc = rmemory_allocator >
1012
class set : public red_black_tree< T, T, false, identity< T >, Cmp, Alloc > {
@@ -29,7 +31,7 @@ class set : public red_black_tree< T, T, false, identity< T >, Cmp, Alloc > {
2931
};
3032

3133
template < typename T, typename Cmp, typename Alloc >
32-
#if VERSION < VERSION_GM8P_00
34+
#if RSTL_VERSION < RSTL_GM8P_00
3335
inline
3436
#endif
3537
set< T, Cmp, Alloc >::set(const set& other)

‎extern/rstl/include/rstl/vector.hpp‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,12 @@
33

44
#include "types.h"
55

6+
#include "rstl/RstlVersions.h"
67
#include "rstl/allocator_auto_ptr.hpp"
78
#include "rstl/iterator.hpp"
89
#include "rstl/pointer_iterator.hpp"
910
#include "rstl/allocator.hpp"
11+
1012
class CInputStream;
1113
class COutputStream;
1214

@@ -189,7 +191,7 @@ void vector< T, Alloc >::insert_into(iterator at, int n, In in) {
189191
int i = moveCount - 1;
190192
for (; i >= 0; --i) {
191193
construct(oldData + atIdx + n + i, data()[atIdx + i]);
192-
#if VERSION >= VERSION_GM8P_00 && VERSION != VERSION_GM8E_02
194+
#if RSTL_VERSION >= RSTL_GM8P_00 && RSTL_VERSION != RSTL_GM8E_02
193195
T* const item = oldData + atIdx + i;
194196
destroy(item);
195197
#else
@@ -210,7 +212,7 @@ void vector< T, Alloc >::insert_into(iterator at, int n, In in) {
210212
x0_allocator.allocate(newData, newCapacity);
211213
long atIdx = at - begin();
212214
// The const alias makes MWCC retain a separate allocation-base register on PAL.
213-
#if VERSION >= VERSION_GM8P_00 && VERSION != VERSION_GM8E_02
215+
#if RSTL_VERSION >= RSTL_GM8P_00 && RSTL_VERSION != RSTL_GM8E_02
214216
T* const newItems = newData;
215217
#else
216218
T* newItems = newData;

‎extern/rstl/src/rstl/rstl_allocator.cpp‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
#include "GameVersions.h"
21

2+
#include "rstl/RstlVersions.h"
33
#include "rstl/allocator.hpp"
44

5-
#if defined(__MWERKS__) && (VERSION >= VERSION_GM8P_00)
5+
#if defined(__MWERKS__) && (RSTL_VERSION >= RSTL_GM8P_00)
66
void* rstl::rmemory_allocator::allocate(int size) {
77
return size == 0 ? nullptr : rs_new uchar[size];
88
}

0 commit comments

Comments
 (0)