File tree Expand file tree Collapse file tree 5 files changed +123
-27
lines changed
ExamplePlugin/include/YYToolkit Expand file tree Collapse file tree 5 files changed +123
-27
lines changed Original file line number Diff line number Diff line change @@ -493,4 +493,33 @@ RValue* YYObjectBase::FindOrAllocValue(
493
493
494
494
return &this ->InternalGetYYVarRef (variable_hash);
495
495
}
496
+
497
+ CRoomInternal& YYTK::CRoom::GetMembers ()
498
+ {
499
+ YYTKInterface* module_interface = GetYYTKInterface ();
500
+
501
+ // Return the more likely thing.
502
+ if (!module_interface)
503
+ return this ->WithBackgrounds .Internals ;
504
+
505
+ size_t bg_color_idx = 0 ;
506
+ AurieStatus last_status = module_interface->GetBuiltinVariableIndex (
507
+ " background_color" ,
508
+ bg_color_idx
509
+ );
510
+
511
+ // This lookup will fail in newer runners where backgrounds were removed
512
+ if (!AurieSuccess (last_status))
513
+ {
514
+ // Note: We have to craft the pointer manually here, since
515
+ // bool alignment prevents us from just having a struct (it'd get aligned to sizeof(PVOID)).
516
+
517
+ // Don't ask why it's from m_Color and not from m_ShowColor, it doesn't make sense
518
+ // and I can't figure out why it works - it just does.
519
+ return *reinterpret_cast <CRoomInternal*>(&this ->m_Color );
520
+ }
521
+
522
+ return this ->WithBackgrounds .Internals ;
523
+ }
524
+
496
525
#endif // YYTK_DEFINE_INTERNAL
Original file line number Diff line number Diff line change 9
9
10
10
#define YYTK_MAJOR 3
11
11
#define YYTK_MINOR 4
12
- #define YYTK_PATCH 0
12
+ #define YYTK_PATCH 3
13
13
14
14
#ifndef YYTK_CPP_VERSION
15
15
#ifndef _MSVC_LANG
@@ -2251,19 +2251,9 @@ namespace YYTK
2251
2251
static_assert (sizeof (CArrayStructure<int >) == 0x10);
2252
2252
#endif // _WIN64
2253
2253
2254
- // Seems to be mostly stable, some elements at the end are however omitted
2255
- struct CRoom
2254
+ struct CRoomInternal
2256
2255
{
2257
- int32_t m_LastTile;
2258
- CRoom* m_InstanceHandle;
2259
- const char * m_Caption;
2260
- int32_t m_Speed;
2261
- int32_t m_Width;
2262
- int32_t m_Height;
2263
- bool m_Persistent;
2264
- uint32_t m_Color;
2265
- bool m_ShowColor;
2266
- CBackGM* m_Backgrounds[8 ];
2256
+ // CBackGM* m_Backgrounds[8];
2267
2257
bool m_EnableViews;
2268
2258
bool m_ClearScreen;
2269
2259
bool m_ClearDisplayBuffer;
@@ -2301,6 +2291,35 @@ namespace YYTK
2301
2291
int32_t m_EffectLayerIdCount;
2302
2292
int32_t m_EffectLayerIdMax;
2303
2293
};
2294
+
2295
+ // Seems to be mostly stable, some elements at the end are however omitted
2296
+ struct CRoom
2297
+ {
2298
+ int32_t m_LastTile;
2299
+ CRoom* m_InstanceHandle;
2300
+ const char * m_Caption;
2301
+ int32_t m_Speed;
2302
+ int32_t m_Width;
2303
+ int32_t m_Height;
2304
+ bool m_Persistent;
2305
+ uint32_t m_Color;
2306
+ bool m_ShowColor;
2307
+ private:
2308
+
2309
+ // Last confirmed use in 2023.8, might be later even
2310
+ struct
2311
+ {
2312
+ CBackGM* Backgrounds[8 ];
2313
+ CRoomInternal Internals;
2314
+ } WithBackgrounds;
2315
+
2316
+ // 2024.6 (first confirmed use) has Backgrounds removed.
2317
+ // CRoomInternal cannot be properly aligned (due to bool having 1-byte alignment),
2318
+ // so GetMembers() crafts the pointer manually instead of having a defined struct here.
2319
+
2320
+ public:
2321
+ CRoomInternal& GetMembers ();
2322
+ };
2304
2323
#ifdef _WIN64
2305
2324
static_assert (sizeof (CRoom) == 0x218);
2306
2325
#endif // _WIN64
Original file line number Diff line number Diff line change @@ -1646,7 +1646,7 @@ namespace YYTK
1646
1646
1647
1647
// Loop all active instances in the room
1648
1648
for (
1649
- CInstance* inst = current_room->m_ActiveInstances .m_First ;
1649
+ CInstance* inst = current_room->GetMembers (). m_ActiveInstances .m_First ;
1650
1650
inst != nullptr ;
1651
1651
inst = inst->GetMembers ().m_Flink
1652
1652
)
Original file line number Diff line number Diff line change @@ -493,4 +493,33 @@ RValue* YYObjectBase::FindOrAllocValue(
493
493
494
494
return &this ->InternalGetYYVarRef (variable_hash);
495
495
}
496
+
497
+ CRoomInternal& YYTK::CRoom::GetMembers ()
498
+ {
499
+ YYTKInterface* module_interface = GetYYTKInterface ();
500
+
501
+ // Return the more likely thing.
502
+ if (!module_interface)
503
+ return this ->WithBackgrounds .Internals ;
504
+
505
+ size_t bg_color_idx = 0 ;
506
+ AurieStatus last_status = module_interface->GetBuiltinVariableIndex (
507
+ " background_color" ,
508
+ bg_color_idx
509
+ );
510
+
511
+ // This lookup will fail in newer runners where backgrounds were removed
512
+ if (!AurieSuccess (last_status))
513
+ {
514
+ // Note: We have to craft the pointer manually here, since
515
+ // bool alignment prevents us from just having a struct (it'd get aligned to sizeof(PVOID)).
516
+
517
+ // Don't ask why it's from m_Color and not from m_ShowColor, it doesn't make sense
518
+ // and I can't figure out why it works - it just does.
519
+ return *reinterpret_cast <CRoomInternal*>(&this ->m_Color );
520
+ }
521
+
522
+ return this ->WithBackgrounds .Internals ;
523
+ }
524
+
496
525
#endif // YYTK_DEFINE_INTERNAL
Original file line number Diff line number Diff line change 9
9
10
10
#define YYTK_MAJOR 3
11
11
#define YYTK_MINOR 4
12
- #define YYTK_PATCH 2
12
+ #define YYTK_PATCH 3
13
13
14
14
#ifndef YYTK_CPP_VERSION
15
15
#ifndef _MSVC_LANG
@@ -2251,19 +2251,9 @@ namespace YYTK
2251
2251
static_assert (sizeof (CArrayStructure<int >) == 0x10);
2252
2252
#endif // _WIN64
2253
2253
2254
- // Seems to be mostly stable, some elements at the end are however omitted
2255
- struct CRoom
2254
+ struct CRoomInternal
2256
2255
{
2257
- int32_t m_LastTile;
2258
- CRoom* m_InstanceHandle;
2259
- const char * m_Caption;
2260
- int32_t m_Speed;
2261
- int32_t m_Width;
2262
- int32_t m_Height;
2263
- bool m_Persistent;
2264
- uint32_t m_Color;
2265
- bool m_ShowColor;
2266
- CBackGM* m_Backgrounds[8 ];
2256
+ // CBackGM* m_Backgrounds[8];
2267
2257
bool m_EnableViews;
2268
2258
bool m_ClearScreen;
2269
2259
bool m_ClearDisplayBuffer;
@@ -2301,6 +2291,35 @@ namespace YYTK
2301
2291
int32_t m_EffectLayerIdCount;
2302
2292
int32_t m_EffectLayerIdMax;
2303
2293
};
2294
+
2295
+ // Seems to be mostly stable, some elements at the end are however omitted
2296
+ struct CRoom
2297
+ {
2298
+ int32_t m_LastTile;
2299
+ CRoom* m_InstanceHandle;
2300
+ const char * m_Caption;
2301
+ int32_t m_Speed;
2302
+ int32_t m_Width;
2303
+ int32_t m_Height;
2304
+ bool m_Persistent;
2305
+ uint32_t m_Color;
2306
+ bool m_ShowColor;
2307
+ private:
2308
+
2309
+ // Last confirmed use in 2023.8, might be later even
2310
+ struct
2311
+ {
2312
+ CBackGM* Backgrounds[8 ];
2313
+ CRoomInternal Internals;
2314
+ } WithBackgrounds;
2315
+
2316
+ // 2024.6 (first confirmed use) has Backgrounds removed.
2317
+ // CRoomInternal cannot be properly aligned (due to bool having 1-byte alignment),
2318
+ // so GetMembers() crafts the pointer manually instead of having a defined struct here.
2319
+
2320
+ public:
2321
+ CRoomInternal& GetMembers ();
2322
+ };
2304
2323
#ifdef _WIN64
2305
2324
static_assert (sizeof (CRoom) == 0x218);
2306
2325
#endif // _WIN64
You can’t perform that action at this time.
0 commit comments