Skip to content

Commit 59b2650

Browse files
committedMar 27, 2022
pushstart, air reader tweaks, tag life fix
1 parent f0b803c commit 59b2650

20 files changed

+607
-179
lines changed
 

‎source/MugenHook/MugenHook.rc

-6 Bytes
Binary file not shown.

‎source/MugenHook/MugenHook.vcxproj

+6-6
Original file line numberDiff line numberDiff line change
@@ -50,22 +50,22 @@
5050
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release_XP|Win32'" Label="Configuration">
5151
<ConfigurationType>DynamicLibrary</ConfigurationType>
5252
<UseDebugLibraries>false</UseDebugLibraries>
53-
<PlatformToolset>v141</PlatformToolset>
53+
<PlatformToolset>v141_xp</PlatformToolset>
5454
<WholeProgramOptimization>true</WholeProgramOptimization>
5555
<CharacterSet>MultiByte</CharacterSet>
5656
</PropertyGroup>
5757
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
5858
<ConfigurationType>DynamicLibrary</ConfigurationType>
5959
<UseDebugLibraries>true</UseDebugLibraries>
6060
<PlatformToolset>v141</PlatformToolset>
61-
<CharacterSet>Unicode</CharacterSet>
61+
<CharacterSet>MultiByte</CharacterSet>
6262
</PropertyGroup>
6363
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
6464
<ConfigurationType>DynamicLibrary</ConfigurationType>
6565
<UseDebugLibraries>false</UseDebugLibraries>
6666
<PlatformToolset>v141</PlatformToolset>
6767
<WholeProgramOptimization>true</WholeProgramOptimization>
68-
<CharacterSet>Unicode</CharacterSet>
68+
<CharacterSet>MultiByte</CharacterSet>
6969
</PropertyGroup>
7070
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release_XP|x64'" Label="Configuration">
7171
<ConfigurationType>DynamicLibrary</ConfigurationType>
@@ -132,7 +132,7 @@
132132
</ClCompile>
133133
<Link>
134134
<SubSystem>Windows</SubSystem>
135-
<GenerateDebugInformation>true</GenerateDebugInformation>
135+
<GenerateDebugInformation>DebugFull</GenerateDebugInformation>
136136
<EnableUAC>false</EnableUAC>
137137
</Link>
138138
</ItemDefinitionGroup>
@@ -143,7 +143,7 @@
143143
<Optimization>Disabled</Optimization>
144144
<SDLCheck>true</SDLCheck>
145145
<PreprocessorDefinitions>_DEBUG;MUGENHOOK_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
146-
<ConformanceMode>true</ConformanceMode>
146+
<ConformanceMode>false</ConformanceMode>
147147
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
148148
</ClCompile>
149149
<Link>
@@ -204,7 +204,7 @@
204204
<IntrinsicFunctions>true</IntrinsicFunctions>
205205
<SDLCheck>true</SDLCheck>
206206
<PreprocessorDefinitions>NDEBUG;MUGENHOOK_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
207-
<ConformanceMode>true</ConformanceMode>
207+
<ConformanceMode>false</ConformanceMode>
208208
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
209209
</ClCompile>
210210
<Link>
+6-10
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,18 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
33
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
4-
<LocalDebuggerCommand>
5-
</LocalDebuggerCommand>
4+
<LocalDebuggerCommand>C:\Users\ermaccer\Desktop\mugen-1.1b1 hook\mugen.exe</LocalDebuggerCommand>
65
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
7-
<LocalDebuggerWorkingDirectory>
8-
</LocalDebuggerWorkingDirectory>
6+
<LocalDebuggerWorkingDirectory>C:\Users\ermaccer\Desktop\mugen-1.1b1 hook</LocalDebuggerWorkingDirectory>
97
</PropertyGroup>
108
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
11-
<LocalDebuggerCommand>
12-
</LocalDebuggerCommand>
9+
<LocalDebuggerCommand>C:\Users\ermaccer\Desktop\mugen-1.1b1 hook\mugen.exe</LocalDebuggerCommand>
1310
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
14-
<LocalDebuggerWorkingDirectory>
15-
</LocalDebuggerWorkingDirectory>
11+
<LocalDebuggerWorkingDirectory>C:\Users\ermaccer\Desktop\mugen-1.1b1 hook</LocalDebuggerWorkingDirectory>
1612
</PropertyGroup>
1713
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release_XP|Win32'">
18-
<LocalDebuggerCommand />
19-
<LocalDebuggerWorkingDirectory />
14+
<LocalDebuggerCommand>C:\Users\ermaccer\Desktop\mugen-1.1b1 hook\mugen.exe</LocalDebuggerCommand>
15+
<LocalDebuggerWorkingDirectory>C:\Users\ermaccer\Desktop\mugen-1.1b1 hook</LocalDebuggerWorkingDirectory>
2016
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
2117
</PropertyGroup>
2218
</Project>

‎source/MugenHook/code/core/eAirReader.cpp

+8-6
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ void eAirReader::ReadData()
3838
for (int i = 0; szLine[i]; i++) {
3939
szLine[i] = tolower(szLine[i]);
4040
}
41-
41+
4242
if (sscanf(szLine, "[begin action %d]", &ID) == 1)
4343
{
4444
while (fgets(szLine, sizeof(szLine), pFile))
@@ -47,20 +47,20 @@ void eAirReader::ReadData()
4747
szLine[i] = tolower(szLine[i]);
4848
}
4949

50-
51-
if (strncmp(szLine,"loopstart", strlen("loopstart")) == 0)
50+
if (eSettingsManager::bEnableAnimationLoop)
5251
{
53-
if (eSettingsManager::bEnableAnimationLoop)
52+
if (strncmp(szLine, "loopstart", strlen("loopstart")) == 0)
5453
{
5554
airEntry.IsLooping = true;
5655
airEntry.LoopStart = airEntry.MaxFrames + 1;
57-
}
5856

57+
}
5958
}
59+
6060
if (szLine[0] == ';' || szLine[0] == '#') continue;
6161
if (szLine[0] == '\r') break;
6262

63-
int iGroupID = 0, iIndex = 0, iXPos = 0, iYPos = 0, iFrameTime = 0;
63+
int iGroupID, iIndex, iXPos, iYPos, iFrameTime;
6464
// remove ,
6565
std::string strLine(szLine, strlen(szLine));
6666
std::replace(strLine.begin(), strLine.end(), ',', ' ');
@@ -73,6 +73,8 @@ void eAirReader::ReadData()
7373
airEntry.vAnimData.push_back(frame);
7474

7575
}
76+
77+
7678
}
7779
airEntry.AnimID = ID;
7880
vAnimations.push_back(airEntry);

‎source/MugenHook/code/core/eCursor.cpp

+24-1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
#include "..\mugenhook\eCommonHooks.h"
44
#include "..\mugenhook\base.h"
55
#include "..\core\eSettingsManager.h"
6+
#include "..\mugen\System.h"
67

78
int eCursor::Player1_Row;
89
int eCursor::Player1_Column;
@@ -35,7 +36,6 @@ void eCursor::Init()
3536
Player2_RandomCharacter = 0;
3637
Player2_Selected = 0;
3738
Player2_Turns = 0;
38-
3939
pCursorEax = 0;
4040

4141
InjectHook(0x406E51, HookCursorPointer, PATCH_JUMP);
@@ -243,3 +243,26 @@ void eCursor::Update()
243243
}
244244
}
245245
}
246+
247+
void eCursor::StoreCursor()
248+
{
249+
if (eCursor::Player1_Character > -1)
250+
{
251+
*(int*)(*(int*)eSystem::pMugenResourcesPointer + 0x2DC) = Player1_Row;
252+
*(int*)(*(int*)eSystem::pMugenResourcesPointer + 0x2E4) = Player1_Column;
253+
}
254+
if (eCursor::Player2_Character > -1)
255+
{
256+
*(int*)(*(int*)eSystem::pMugenResourcesPointer + 0x2E0) = Player2_Row;
257+
*(int*)(*(int*)eSystem::pMugenResourcesPointer + 0x2E8) = Player2_Column;
258+
}
259+
}
260+
261+
void eCursor::PopCursor()
262+
{
263+
*(int*)(*(int*)eSystem::pMugenResourcesPointer + 0x2DC) = eSystem::p1_cursor_startcell[0];
264+
*(int*)(*(int*)eSystem::pMugenResourcesPointer + 0x2E4) = eSystem::p1_cursor_startcell[1];
265+
266+
*(int*)(*(int*)eSystem::pMugenResourcesPointer + 0x2E0) = eSystem::p2_cursor_startcell[0];
267+
*(int*)(*(int*)eSystem::pMugenResourcesPointer + 0x2E8) = eSystem::p2_cursor_startcell[1];
268+
}

‎source/MugenHook/code/core/eCursor.h

+3
Original file line numberDiff line numberDiff line change
@@ -27,4 +27,7 @@ class eCursor {
2727
static void HookCursorMoveUp();
2828
static void Update();
2929

30+
static void StoreCursor();
31+
static void PopCursor();
32+
3033
};

‎source/MugenHook/code/mugen/Draw.cpp

+51-2
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,56 @@ int LoadFont(char * file, int param)
66
return CallAndReturn<int, 0x46D030, char*, int>(file, param);
77
}
88

9-
void Draw2DText(char* text, int font, int x, int y, int unk, int unk2, int r, int g, int b)
9+
void Draw2DTextDebug(char * text, int font, int x, int y, int unk, int unk2, int r, int g, int b)
1010
{
1111
Call<0x46CE40, char*, int, int, int, int, int, int, int, int>(text, font, x, y, unk, unk2, r, g, b);
12-
}
12+
}
13+
14+
void Draw2DTextReal(char * text, int font, eTextParams * params, int unk, int unk2, int r, int g, int b)
15+
{
16+
Call<0x46CA80, char*, int, eTextParams*, int, int, int, int, int>(text, font, params, unk, unk2, r, g, b);
17+
}
18+
19+
void __declspec(naked) Draw2DText(char* text, int font, eTextParams* params, int r, int g, int b, int align)
20+
{
21+
_asm {
22+
push ebp
23+
mov ebp, esp
24+
sub esp, __LOCAL_SIZE
25+
26+
mov ecx, b
27+
mov edx, g
28+
mov eax, r
29+
30+
push ecx // B
31+
32+
mov ecx, 0
33+
34+
push edx // G
35+
36+
mov edx, align
37+
38+
push eax // R
39+
40+
push ecx // UNK2
41+
42+
mov ecx, font
43+
44+
push edx // UNK
45+
46+
//lea eax, Dst
47+
push params // PARAMS
48+
49+
mov eax, text
50+
51+
push ecx // FONT
52+
53+
mov edx, 0x46CA80
54+
call edx
55+
56+
mov esp, ebp
57+
pop ebp
58+
ret
59+
}
60+
61+
}

‎source/MugenHook/code/mugen/Draw.h

+71-1
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,78 @@
11
#pragma once
22

3+
enum eTextAlign {
4+
ALIGN_RIGHT = -1,
5+
ALIGN_CENTER,
6+
ALIGN_LEFT,
7+
};
8+
9+
struct eTextParams
10+
{
11+
float rotateY;
12+
float field_4;
13+
float m_xPos;
14+
float m_yPos;
15+
float m_scaleY;
16+
float m_scaleX;
17+
char field_18;
18+
char field_19;
19+
char field_1A;
20+
char field_1B;
21+
char field_1C;
22+
char field_1D;
23+
char field_1E;
24+
char field_1F;
25+
float m_letterSpacingY;
26+
float m_letterSpacingX;
27+
char field_28;
28+
char field_29;
29+
char field_2A;
30+
char field_2B;
31+
char field_2C;
32+
char field_2D;
33+
char field_2E;
34+
char field_2F;
35+
char field_30;
36+
char field_31;
37+
char field_32;
38+
char field_33;
39+
char field_34;
40+
char field_35;
41+
char field_36;
42+
char field_37;
43+
char field_38;
44+
char field_39;
45+
char field_3A;
46+
char field_3B;
47+
float field_3C;
48+
float m_skew;
49+
char field_44;
50+
char field_45;
51+
char field_46;
52+
char field_47;
53+
char field_48;
54+
char field_49;
55+
char field_4A;
56+
char field_4B;
57+
int m_hasBackground;
58+
float field_50;
59+
char field_54;
60+
char field_55;
61+
char field_56;
62+
char field_57;
63+
char field_58;
64+
char field_59;
65+
char field_5A;
66+
char field_5B;
67+
int field_5C;
68+
};
69+
370

471
// fonts
572
int LoadFont(char* file, int param);
673

774
// drawing
8-
void Draw2DText(char* text, int font, int x, int y, int unk, int unk2, int r, int g, int b);
75+
void Draw2DTextDebug(char* text, int font, int x, int y, int unk, int unk2, int r, int g, int b);
76+
void Draw2DTextReal(char* text, int font, eTextParams* params, int unk, int unk2, int r, int g, int b);
77+
78+
void Draw2DText(char* text, int font, eTextParams* params, int r, int g, int b, int align);

‎source/MugenHook/code/mugen/System.cpp

+86-1
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,11 @@ int eSystem::iPortraitIndex;
1717
int eSystem::pMugenResourcesPointer;
1818
int eSystem::pMugenCharactersPointer;
1919
int eSystem::pMugenDataPointer;
20-
20+
int eSystem::p1_cursor_startcell[2];
21+
int eSystem::p2_cursor_startcell[2];
2122
float eSystem::p1_face_offset[2];
2223
float eSystem::p2_face_offset[2];
24+
pushstart_settings eSystem::pushstart_set = {};
2325

2426
void eSystem::Init()
2527
{
@@ -40,6 +42,12 @@ void eSystem::Init()
4042
p2_face_offset[0] = 0;
4143
p2_face_offset[1] = 0;
4244

45+
p1_cursor_startcell[0] = 0;
46+
p1_cursor_startcell[1] = 0;
47+
48+
p2_cursor_startcell[0] = 0;
49+
p2_cursor_startcell[1] = 0;
50+
4351
pMugenResourcesPointer = 0x503388;
4452
pMugenCharactersPointer = 0x503394;
4553
pMugenDataPointer = 0x5040E8;
@@ -55,6 +63,9 @@ void eSystem::Init()
5563
iRows = system.ReadInteger("Select Info", "rows", 0);
5664
iColumns = system.ReadInteger("Select Info", "columns", 0);
5765

66+
sscanf(system.ReadString("Select Info", "p1.cursor.startcell", 0), "%d,%d", &p1_cursor_startcell[0], &p1_cursor_startcell[1]);
67+
68+
sscanf(system.ReadString("Select Info", "p2.cursor.startcell", 0), "%d,%d", &p2_cursor_startcell[0], &p2_cursor_startcell[1]);
5869
// save og values
5970
sscanf(system.ReadString("Select Info", "p1.face.offset", 0), "%f,%f", &p1_face_offset[0], &p1_face_offset[1]);
6071
sscanf(system.ReadString("Select Info", "p2.face.offset", 0), "%f,%f", &p2_face_offset[0], &p2_face_offset[1]);
@@ -64,6 +75,43 @@ void eSystem::Init()
6475
sscanf(system.ReadString("Select Info", "p2.cursor.done.snd", 0), "%d,%d", &iSoundP2DoneGroup, &iSoundP2DoneIndex);
6576
sscanf(system.ReadString("Select Info", "portrait.spr", 0), "%d,%d", &iPortraitGroup, &iPortraitIndex);
6677

78+
pushstart_set.active = system.ReadInteger("Select Info", "pushstart.active", 0);
79+
sprintf(pushstart_set.text, system.ReadString("Select Info", "pushstart.text", 0));
80+
sprintf(pushstart_set.font, system.ReadString("Select Info", "pushstart.font", "font/F-4X6.fnt"));
81+
82+
for (int i = 0; i < 512; i++)
83+
{
84+
if (pushstart_set.text[i] == 0x5C)
85+
{
86+
printf("patching\n");
87+
if (pushstart_set.text[i + 1] == 0x6E)
88+
{
89+
pushstart_set.text[i] = 0xD;
90+
pushstart_set.text[i + 1] = 0xA;
91+
}
92+
}
93+
}
94+
95+
96+
pushstart_set.color_r = system.ReadInteger("Select Info", "pushstart.color.r", 0);
97+
pushstart_set.color_g = system.ReadInteger("Select Info", "pushstart.color.g", 0);
98+
pushstart_set.color_b = system.ReadInteger("Select Info", "pushstart.color.b", 0);
99+
100+
pushstart_set.scale_x = system.ReadFloat("Select Info", "pushstart.scale.x", 0);
101+
pushstart_set.scale_y = system.ReadFloat("Select Info", "pushstart.scale.y", 0);
102+
103+
pushstart_set.p1_x = system.ReadInteger("Select Info", "pushstart.p1.x", 0);
104+
pushstart_set.p1_y = system.ReadInteger("Select Info", "pushstart.p1.y", 0);
105+
106+
pushstart_set.p2_x = system.ReadInteger("Select Info", "pushstart.p2.x", 0);
107+
pushstart_set.p2_y = system.ReadInteger("Select Info", "pushstart.p2.y", 0);
108+
109+
pushstart_set.p1_align = system.ReadInteger("Select Info", "pushstart.p1.align", 0);
110+
pushstart_set.p2_align = system.ReadInteger("Select Info", "pushstart.p2.align", 0);
111+
112+
pushstart_set.group = system.ReadInteger("Select Info", "pushstart.snd.group", -1);
113+
pushstart_set.index = system.ReadInteger("Select Info", "pushstart.snd.index", -1);
114+
67115
eLog::PushMessage(__FUNCTION__, "Success! Done reading motif data\n");
68116
}
69117
}
@@ -104,3 +152,40 @@ int eSystem::GetCharactersAmount()
104152
{
105153
return iRows * iColumns;
106154
}
155+
156+
void eSystem::SetGameFlow(eGameFlowType flow)
157+
{
158+
*(int*)(*(int*)(0x5040C4)) = flow;
159+
}
160+
161+
void eSystem::SetGameplayMode(eGameplayModes mode)
162+
{
163+
if (*(int*)pMugenDataPointer)
164+
*(int*)(*(int*)pMugenDataPointer + 0x5094) = mode;
165+
}
166+
167+
void eSystem::ClearScreenparams(eSelectScreenParams * params)
168+
{
169+
for (int i = 0; i < 800; i++)
170+
params->data[i] = 0x00;
171+
}
172+
173+
void __declspec(naked) eSystem::SetScreenParams(eSelectScreenParams * params, int gameMode, int unk)
174+
{
175+
_asm {
176+
push ebp
177+
mov ebp, esp
178+
sub esp, __LOCAL_SIZE
179+
180+
mov eax, unk
181+
mov edx, gameMode
182+
mov ecx, params
183+
184+
mov esi, 0x408B20
185+
call esi
186+
187+
mov esp, ebp
188+
pop ebp
189+
ret
190+
}
191+
}

‎source/MugenHook/code/mugen/System.h

+49-2
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,19 @@ enum eGameModes {
2222

2323

2424
enum eGameFlowType {
25-
FLOW_INTRO = 3,
25+
FLOW_0,
26+
FLOW_1,
27+
FLOW_2,
28+
FLOW_INTRO,
2629
FLOW_MENU,
2730
FLOW_OPTIONS,
2831
FLOW_RESET_VARS,
2932
FLOW_SELECT_SCREEN,
3033
FLOW_8,
3134
FLOW_9,
3235
FLOW_VERSUS,
33-
FLOW_IN_GAME
36+
FLOW_IN_GAME,
37+
FLOW_QUIT_LOOP = 20
3438
};
3539

3640

@@ -75,6 +79,35 @@ struct eMugenData {
7579

7680
};
7781

82+
struct eSelectScreenParams {
83+
char data[1200];
84+
};
85+
86+
struct eGameFlowData {
87+
int status;
88+
eSelectScreenParams* params;
89+
char _pad[60];
90+
int deinit;
91+
char __pad[32];
92+
int quit;
93+
};
94+
95+
struct pushstart_settings {
96+
int active;
97+
char text[512] = {};
98+
char font[512] = {};
99+
int flash;
100+
int color_r;
101+
int color_g;
102+
int color_b;
103+
float scale_x;
104+
float scale_y;
105+
int p1_x, p1_y;
106+
int p2_x, p2_y;
107+
int p1_align, p2_align;
108+
int group, index;
109+
};
110+
78111

79112
class eSystem {
80113
public:
@@ -97,11 +130,25 @@ class eSystem {
97130
static float p1_face_offset[2];
98131
static float p2_face_offset[2];
99132

133+
static int p1_cursor_startcell[2];
134+
static int p2_cursor_startcell[2];
135+
136+
// join in settings
137+
138+
static pushstart_settings pushstart_set;
139+
100140
static void Init();
101141

102142
static Sound* GetSystemSND();
103143
static int GetGameFlow();
104144
static int GetGameplayMode();
105145
static int GetTimer();
106146
static int GetCharactersAmount();
147+
148+
static void SetGameFlow(eGameFlowType flow);
149+
static void SetGameplayMode(eGameplayModes mode);
150+
151+
152+
static void ClearScreenparams(eSelectScreenParams* params);
153+
static void SetScreenParams(eSelectScreenParams* params, int gameMode, int unk);
107154
};

‎source/MugenHook/code/mugenhook/base.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#pragma once
22
#include "..\..\MemoryMgr.h"
33
#include "..\..\IniReader.h"
4-
#define MUGENHOOK_VERSION "0.6.0"
4+
#define MUGENHOOK_VERSION "0.6.1"
55

66

77
typedef unsigned char uint8;

‎source/MugenHook/code/mugenhook/eAnimatedPortraits.cpp

+35-131
Original file line numberDiff line numberDiff line change
@@ -157,8 +157,8 @@ void eAnimatedPortraits::Process()
157157
eAirEntry Animation;
158158
int iAnimEntry;
159159

160-
if (!eSettingsManager::bEnableSelectAnimations)
161-
{
160+
if (!eCursor::Player1_Selected || !eSettingsManager::bEnableSelectAnimations) {
161+
162162
eMugenCharacterInfo* CharactersArray = *(eMugenCharacterInfo**)0x503394;
163163

164164
// get anims
@@ -175,6 +175,7 @@ void eAnimatedPortraits::Process()
175175
}
176176

177177
Animation = AIR_Reader.GetAnimation(AnimationTable[iAnimEntry].SelectAnimationID + multipiler);
178+
178179
// set scale
179180
if (eSettingsManager::bEnableAnimationScale) {
180181
*(float*)(*(int*)eSystem::pMugenResourcesPointer + 0x808 + 0x40) = AnimationTable[iAnimEntry].SpritesScaleX; // p1.face.scale
@@ -183,79 +184,40 @@ void eAnimatedPortraits::Process()
183184

184185

185186
// loop
186-
if (iFrameCounter_p1 > Animation.MaxFrames - 1)
187+
if (eCursor::Player1_Character == -2)
188+
iFrameCounter_p1 = 0;
189+
else
187190
{
188-
if (Animation.IsLooping)
189-
iFrameCounter_p1 = Animation.LoopStart - 1;
190-
else
191-
iFrameCounter_p1 = 0;
192-
}
193-
194-
// set sprites
195-
*(int*)(*(int*)eSystem::pMugenResourcesPointer + 0x80C) = Animation.vAnimData[iFrameCounter_p1].Group; // p1.face group
196-
*(int*)(*(int*)eSystem::pMugenResourcesPointer + 0x810) = Animation.vAnimData[iFrameCounter_p1].Index; // p1.face index
197-
198-
// perform animation
199-
if (eSystem::GetTimer() - iTickCounter_p1 <= Animation.vAnimData[iFrameCounter_p1].Frametime) return;
200-
iFrameCounter_p1++;
201-
202-
// reset timer
203-
iTickCounter_p1 = eSystem::GetTimer();
204-
}
205-
else
206-
{
207-
if (!eCursor::Player1_Selected) {
208-
209-
eMugenCharacterInfo* CharactersArray = *(eMugenCharacterInfo**)0x503394;
210-
211-
// get anims
212-
AIR_Reader = GetAIRFromName(GetCellFName(eCursor::Player1_Row, eCursor::Player1_Column));
213-
iAnimEntry = FindPortraitEntry(eCursor::Player1_Row, eCursor::Player1_Column);
214-
int multipiler = 0;
215-
if ((CharactersArray[eCursor::Player1_Character].CharacterFlag & CHAR_FLAG_VARIATIONS))
216-
{
217-
if (CharactersArray[eCursor::Player1_Character].CurrentVariation > 1)
218-
{
219-
multipiler = 100 * (CharactersArray[eCursor::Player1_Character].CurrentVariation - 1);
220-
}
221-
222-
}
223-
224-
Animation = AIR_Reader.GetAnimation(AnimationTable[iAnimEntry].SelectAnimationID + multipiler);
225-
226-
// set scale
227-
if (eSettingsManager::bEnableAnimationScale) {
228-
*(float*)(*(int*)eSystem::pMugenResourcesPointer + 0x808 + 0x40) = AnimationTable[iAnimEntry].SpritesScaleX; // p1.face.scale
229-
*(float*)(*(int*)eSystem::pMugenResourcesPointer + 0x808 + 0x44) = AnimationTable[iAnimEntry].SpritesScaleY; // p1.face.scale
230-
}
231-
232-
233-
// loop
234191
if (iFrameCounter_p1 > Animation.MaxFrames - 1)
235192
{
236193
if (Animation.IsLooping)
237194
iFrameCounter_p1 = Animation.LoopStart - 1;
238195
else
239196
iFrameCounter_p1 = 0;
240197
}
198+
}
241199

242-
// set sprites
243-
*(int*)(*(int*)eSystem::pMugenResourcesPointer + 0x80C) = Animation.vAnimData[iFrameCounter_p1].Group; // p1.face group
244-
*(int*)(*(int*)eSystem::pMugenResourcesPointer + 0x810) = Animation.vAnimData[iFrameCounter_p1].Index; // p1.face index
200+
201+
// set sprites
202+
*(int*)(*(int*)eSystem::pMugenResourcesPointer + 0x80C) = Animation.vAnimData[iFrameCounter_p1].Group; // p1.face group
203+
*(int*)(*(int*)eSystem::pMugenResourcesPointer + 0x810) = Animation.vAnimData[iFrameCounter_p1].Index; // p1.face index
245204

246205

247-
// perform animation
248-
if (eSystem::GetTimer() - iTickCounter_p1 <= Animation.vAnimData[iFrameCounter_p1].Frametime) return;
206+
// perform animation
207+
if (eSystem::GetTimer() - iTickCounter_p1 <= Animation.vAnimData[iFrameCounter_p1].Frametime) return;
208+
if (!(eCursor::Player1_Character == -2))
249209
iFrameCounter_p1++;
250210

251-
// reset timer
252-
iTickCounter_p1 = eSystem::GetTimer();
211+
// reset timer
212+
iTickCounter_p1 = eSystem::GetTimer();
253213

254-
// fix bug where any character select animation would be stuck at last frame
255-
iSelectCounter_p1 = 0;
214+
// fix bug where any character select animation would be stuck at last frame
215+
iSelectCounter_p1 = 0;
256216

257-
}
258-
else
217+
}
218+
else
219+
{
220+
if (eSettingsManager::bEnableSelectAnimations)
259221
{
260222
eMugenCharacterInfo* CharactersArray = *(eMugenCharacterInfo**)0x503394;
261223

@@ -286,7 +248,7 @@ void eAnimatedPortraits::Process()
286248
if (Animation.IsLooping)
287249
iSelectCounter_p1 = Animation.LoopStart - 1;
288250
else
289-
iSelectCounter_p1 = Animation.MaxFrames - 1;
251+
iSelectCounter_p1 = Animation.MaxFrames - 1;
290252
}
291253

292254
// set sprites
@@ -297,20 +259,22 @@ void eAnimatedPortraits::Process()
297259
iSelectCounter_p1++;
298260
iTickCounter_p1 = eSystem::GetTimer();
299261
}
262+
300263
}
301264
}
302-
265+
static bool m_bGotAnimation = false;
303266
void eAnimatedPortraits::ProcessP2()
304267
{
305268
eAirReader reader;
306269
eAirEntry animation, alt_anim;
307270
bool m_bOnPlayerOne = false;
271+
308272
int iMaxFrames;
309273
int iAnimEntry;
310274

311275
if (eCursor::Player1_Row == eCursor::Player2_Row && eCursor::Player1_Column == eCursor::Player2_Column) m_bOnPlayerOne = true;
312276

313-
if (!eSettingsManager::bEnableSelectAnimations)
277+
if (!eCursor::Player2_Selected || !eSettingsManager::bEnableSelectAnimations)
314278
{
315279
reader = GetAIRFromName(GetCellFName(eCursor::Player2_Row, eCursor::Player2_Column));
316280
iAnimEntry = FindPortraitEntry(eCursor::Player2_Row, eCursor::Player2_Column);
@@ -325,7 +289,7 @@ void eAnimatedPortraits::ProcessP2()
325289
}
326290

327291
}
328-
292+
329293
animation = reader.GetAnimation(AnimationTable[iAnimEntry].SelectAnimationID + multipiler);
330294
alt_anim = reader.GetAnimation(AnimationTable[iAnimEntry].SelectAnimationAlternateID + multipiler);
331295

@@ -339,6 +303,8 @@ void eAnimatedPortraits::ProcessP2()
339303
*(float*)(*(int*)eSystem::pMugenResourcesPointer + 0x808 + 0x40 + 0xD4 + 8) = AnimationTable[iAnimEntry].SpritesScaleY; // p2.face.scale
340304
}
341305

306+
307+
342308
if (iFrameCounter_p2 > iMaxFrames)
343309
{
344310
if (animation.IsLooping || alt_anim.IsLooping)
@@ -352,7 +318,6 @@ void eAnimatedPortraits::ProcessP2()
352318
iFrameCounter_p2 = 0;
353319
}
354320

355-
356321
if (m_bOnPlayerOne && eSettingsManager::bEnableAlternateAnims)
357322
{
358323
*(int*)(*(int*)eSystem::pMugenResourcesPointer + 0x810 + 0xD0 + 4) = alt_anim.vAnimData[iFrameCounter_p2].Group;
@@ -367,69 +332,11 @@ void eAnimatedPortraits::ProcessP2()
367332
if (eSystem::GetTimer() - iTickCounter_p2 <= animation.vAnimData[iFrameCounter_p2].Frametime) return;
368333
iFrameCounter_p2++;
369334
iTickCounter_p2 = eSystem::GetTimer();
335+
iSelectCounter_p2 = 0;
370336
}
371-
else {
372-
if (!eCursor::Player2_Selected)
373-
{
374-
reader = GetAIRFromName(GetCellFName(eCursor::Player2_Row, eCursor::Player2_Column));
375-
iAnimEntry = FindPortraitEntry(eCursor::Player2_Row, eCursor::Player2_Column);
376-
eMugenCharacterInfo* CharactersArray = *(eMugenCharacterInfo**)0x503394;
377-
378-
int multipiler = 0;
379-
if ((CharactersArray[eCursor::Player2_Character].CharacterFlag & CHAR_FLAG_VARIATIONS))
380-
{
381-
if (CharactersArray[eCursor::Player2_Character].CurrentVariation > 1)
382-
{
383-
multipiler = 100 * (CharactersArray[eCursor::Player2_Character].CurrentVariation - 1);
384-
}
385-
386-
}
387-
388-
animation = reader.GetAnimation(AnimationTable[iAnimEntry].SelectAnimationID + multipiler);
389-
alt_anim = reader.GetAnimation(AnimationTable[iAnimEntry].SelectAnimationAlternateID + multipiler);
390-
391-
392-
if (m_bOnPlayerOne && eSettingsManager::bEnableAlternateAnims) iMaxFrames = alt_anim.MaxFrames - 1;
393-
else iMaxFrames = animation.MaxFrames - 1;
394-
395-
if (eSettingsManager::bEnableAnimationScale)
396-
{
397-
*(float*)(*(int*)eSystem::pMugenResourcesPointer + 0x808 + 0x40 + 0xD4 + 4) = AnimationTable[iAnimEntry].SpritesScaleX; // p2.face.scale
398-
*(float*)(*(int*)eSystem::pMugenResourcesPointer + 0x808 + 0x40 + 0xD4 + 8) = AnimationTable[iAnimEntry].SpritesScaleY; // p2.face.scale
399-
}
400-
401-
402-
403-
if (iFrameCounter_p2 > iMaxFrames)
404-
{
405-
if (animation.IsLooping || alt_anim.IsLooping)
406-
{
407-
if (animation.IsLooping)
408-
iFrameCounter_p2 = animation.LoopStart - 1;
409-
else if (alt_anim.IsLooping)
410-
iFrameCounter_p2 = alt_anim.LoopStart - 1;
411-
}
412-
else
413-
iFrameCounter_p2 = 0;
414-
}
415-
416-
if (m_bOnPlayerOne && eSettingsManager::bEnableAlternateAnims)
417-
{
418-
*(int*)(*(int*)eSystem::pMugenResourcesPointer + 0x810 + 0xD0 + 4) = alt_anim.vAnimData[iFrameCounter_p2].Group;
419-
*(int*)(*(int*)eSystem::pMugenResourcesPointer + 0x810 + 0xD0 + 8) = alt_anim.vAnimData[iFrameCounter_p2].Index;
420-
}
421-
else {
422-
*(int*)(*(int*)eSystem::pMugenResourcesPointer + 0x810 + 0xD0 + 4) = animation.vAnimData[iFrameCounter_p2].Group;
423-
*(int*)(*(int*)eSystem::pMugenResourcesPointer + 0x810 + 0xD0 + 8) = animation.vAnimData[iFrameCounter_p2].Index;
424-
}
425-
426-
427-
if (eSystem::GetTimer() - iTickCounter_p2 <= animation.vAnimData[iFrameCounter_p2].Frametime) return;
428-
iFrameCounter_p2++;
429-
iTickCounter_p2 = eSystem::GetTimer();
430-
iSelectCounter_p2 = 0;
431-
}
432-
else
337+
else
338+
{
339+
if (eSettingsManager::bEnableSelectAnimations)
433340
{
434341
reader = GetAIRFromName(GetCellFName(eCursor::Player2_Row, eCursor::Player2_Column));
435342
iAnimEntry = FindPortraitEntry(eCursor::Player2_Row, eCursor::Player2_Column);
@@ -445,8 +352,6 @@ void eAnimatedPortraits::ProcessP2()
445352
}
446353

447354
}
448-
449-
450355
animation = GetAIRFromName(GetCellFName(eCursor::Player2_Row, eCursor::Player2_Column)).GetAnimation(AnimationTable[iAnimEntry].WinAnimationID + multipiler);
451356
alt_anim = GetAIRFromName(GetCellFName(eCursor::Player2_Row, eCursor::Player2_Column)).GetAnimation(AnimationTable[iAnimEntry].WinAnimationAlternateID + multipiler);
452357

@@ -462,7 +367,7 @@ void eAnimatedPortraits::ProcessP2()
462367
if (animation.IsLooping)
463368
iSelectCounter_p2 = animation.LoopStart - 1;
464369
else if (alt_anim.IsLooping)
465-
iSelectCounter_p2 = alt_anim.LoopStart - 1 ;
370+
iSelectCounter_p2 = alt_anim.LoopStart - 1;
466371
}
467372
else
468373
iSelectCounter_p2 = iMaxFrames;
@@ -556,7 +461,6 @@ int eAnimatedPortraits::HookDisplaySprites(int a1, int a2, int a3, int a4, int a
556461
ProcessP2();
557462
}
558463

559-
560464
eCommonHooks::ProcessCharacterSpriteEvent();
561465

562466
return DrawSprites(a1, a2, a3, a4, a5, a6, 0);

‎source/MugenHook/code/mugenhook/eCommonHooks.cpp

+22-15
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
void eCommonHooks::Init()
1818
{
1919
InjectHook(0x429B14, HookDrawMugenVersionInfo, PATCH_CALL);
20-
InjectHook(0x406E1D, ProcessSelectScreenEvent, PATCH_JUMP);
20+
InjectHook(0x4089A4, HookSelectScreenProcessEnd, PATCH_JUMP);
2121
}
2222

2323
void eCommonHooks::ProcessSelectScreen()
@@ -107,28 +107,35 @@ void eCommonHooks::ProcessCharacterSpriteEvent()
107107
eSlidingPortraits::ProcessP2();
108108
}
109109

110-
110+
if (eSettingsManager::bHookMagicBoxes)
111+
eMagicBoxes::Process();
111112

112113
//eAnimatedIcons::FlagCharacters();
113114
}
114115

115-
void __declspec(naked) eCommonHooks::ProcessSelectScreenEvent()
116+
void eCommonHooks::HookPushDebugMessage(const char * message)
117+
{
118+
printf(message);
119+
}
120+
121+
122+
void __declspec(naked) eCommonHooks::HookSelectScreenProcessEnd()
116123
{
117-
static int jmpContinue = 0x406E23;
118-
_asm {
119-
mov ebx, ds:0x5040E8
124+
static int end_jmp = 0x4089AB;
125+
_asm
126+
{
120127
pushad
121128
}
122-
if (eSettingsManager::bHookMagicBoxes)
123-
eMagicBoxes::Process();
124-
_asm {
129+
130+
eSelectScreenManager::ProcessEnd();
131+
132+
_asm
133+
{
125134
popad
126-
jmp jmpContinue
135+
pop edi
136+
pop esi
137+
mov eax, 1
138+
jmp end_jmp
127139
}
128140
}
129141

130-
void eCommonHooks::HookPushDebugMessage(const char * message)
131-
{
132-
printf(message);
133-
}
134-

‎source/MugenHook/code/mugenhook/eCommonHooks.h

+3-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,9 @@ namespace eCommonHooks {
1010
void ProcessCommonCursorEvent();
1111
void HookDrawMugenVersionInfo(const char * message, int a2, int a3, int a4, int a5, char r, char g, char b);
1212
void ProcessCharacterSpriteEvent();
13-
void ProcessSelectScreenEvent();
1413
void HookPushDebugMessage(const char* message);
14+
void HookGameLoop();
15+
16+
void HookSelectScreenProcessEnd();
1517

1618
}

‎source/MugenHook/code/mugenhook/eMenuManager.cpp

+2
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
#include "eMagicBoxes.h"
77
#include "eVariationsManager.h"
88
#include "eAnimatedIcons.h"
9+
#include "..\core\eCursor.h"
910

1011
bool eMenuManager::m_bIsInMainMenu;
1112
bool eMenuManager::m_bIsInSelectScreen;
@@ -73,6 +74,7 @@ int eMenuManager::HookSelectScreenMenu()
7374
m_bIsInMainMenu = false;
7475
m_bIsInSelectScreen = true;
7576
m_bAnimsRequireRefresh = true;
77+
eCursor::PopCursor();
7678
return CallAndReturn<int, 0x408A80>();
7779
}
7880

‎source/MugenHook/code/mugenhook/eScriptProcessor.cpp

+6
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
#include "eScriptProcessor.h"
22
#include "base.h"
3+
#include "..\core\eInputManager.h"
4+
#include "..\mugen\System.h"
5+
#include "..\mugen\Draw.h"
6+
#include "..\core\eCursor.h"
7+
#include "..\mugen\System.h"
8+
#include "eSelectScreenManager.h"
39

410
void eScriptProcessor::Init()
511
{

‎source/MugenHook/code/mugenhook/eSelectScreenManager.cpp

+183-2
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
#include "..\mugen\Sound.h"
1616
#include "..\mugen\Sprite.h"
1717
#include "..\mugen\Common.h"
18+
#include "..\mugen\Draw.h"
1819

1920
int eSelectScreenManager::m_bPlayer1HasFinishedWaiting;
2021
int eSelectScreenManager::m_bPlayer2HasFinishedWaiting;
@@ -31,6 +32,8 @@ std::string eSelectScreenManager::m_pSelectScreenLastString;
3132

3233
bool eSelectScreenManager::m_bCachedSoundData;
3334

35+
eGameFlowData* eSelectScreenManager::m_pGameFlowData;
36+
3437
eMugenCharacterInfo* eSelectScreenManager::m_pCharacter;
3538

3639
void eSelectScreenManager::Init()
@@ -53,6 +56,10 @@ void eSelectScreenManager::Init()
5356
InjectHook(0x407453, ProcessDrawingCharacterFace, PATCH_CALL);
5457
InjectHook(0x404029, HookSelectIDs, PATCH_JUMP);
5558
InjectHook(0x40380D, HookLoadCharacterData, PATCH_CALL);
59+
60+
Nop(0x408AA3, 7);
61+
InjectHook(0x408AA3, HookCurrentScreenGameData, PATCH_JUMP);
62+
5663
}
5764

5865
void eSelectScreenManager::Process()
@@ -66,11 +73,17 @@ void eSelectScreenManager::Process()
6673
}
6774
}
6875

69-
if (eSettingsManager::bDev_DisplayPos) printf("Player 1: Row: %d Column: %d Character: %d \r", eCursor::Player1_Row, eCursor::Player1_Column, eCursor::Player1_RandomCharacter);
76+
if (eSettingsManager::bDev_DisplayPos) printf("Player 1: Row: %d Column: %d Character: %d \r", eCursor::Player1_Row, eCursor::Player1_Column, eCursor::Player1_Character);
7077

7178
if (GetAsyncKeyState(VK_F5) && eSettingsManager::bDumpCharacterInfo) PrintCharacterData();
7279

73-
80+
printf("%x %d\n", eCursor::pCursorEax + 0x39FE, eCursor::Player1_Turns);
81+
int mode = eSystem::GetGameplayMode();
82+
if (!(mode == MODE_VERSUS || mode == MODE_TEAM_VERSUS || mode == MODE_TEAM_COOP || mode == MODE_TRAINING))
83+
{
84+
ProcessPlayer2JoinIn();
85+
}
86+
7487
if (eSettingsManager::bRandomStageConfirmSounds && !eSettingsManager::bHookStageAnnouncer)
7588
{
7689
*(int*)(*(int*)eSystem::pMugenResourcesPointer + 0x36C) = eSettingsManager::iRandomStageGroup;
@@ -98,6 +111,73 @@ void eSelectScreenManager::Process()
98111

99112
}
100113

114+
void eSelectScreenManager::ProcessEnd()
115+
{
116+
if (eSystem::pushstart_set.active)
117+
{
118+
static int font = 0;
119+
120+
if (!font)
121+
font = LoadFont(eSystem::pushstart_set.font, 1);
122+
123+
124+
if (eSystem::GetGameFlow() == FLOW_SELECT_SCREEN)
125+
{
126+
if (eSystem::GetGameplayMode() == MODE_ARCADE || eSystem::GetGameplayMode() == MODE_TEAM_ARCADE)
127+
{
128+
int gameModeView = *(int*)(eMenuManager::m_pSelectScreenDataPointer + 0x3BA4);
129+
int gameModeView_p2 = *(int*)(eMenuManager::m_pSelectScreenDataPointer + 0x3BA4 + 180);
130+
131+
eTextParams params = {};
132+
params.m_letterSpacingX = 1.0;
133+
params.m_letterSpacingY = 1.0;
134+
params.field_50 = 1.0;
135+
params.m_skew = 1.0;
136+
params.field_3C = 0.0;
137+
params.rotateY = 1.0;
138+
params.field_4 = 0.0;
139+
140+
params.field_5C = 0xFFFF;
141+
params.m_hasBackground = 1;
142+
143+
params.m_scaleX = eSystem::pushstart_set.scale_x;
144+
params.m_scaleY = eSystem::pushstart_set.scale_y;
145+
params.m_xPos = eSystem::pushstart_set.p1_x;
146+
params.m_yPos = eSystem::pushstart_set.p1_y;
147+
148+
eTextParams params2 = params;
149+
params2.m_xPos = eSystem::pushstart_set.p2_x;
150+
params2.m_yPos = eSystem::pushstart_set.p2_y;
151+
152+
if (eCursor::Player1_Character == -1 && !eCursor::Player2_Selected)
153+
{
154+
if (eCursor::Player2_Turns < 1)
155+
{
156+
if (gameModeView == 0)
157+
{
158+
if (eSystem::GetTimer() & 16)
159+
Draw2DText(eSystem::pushstart_set.text, font, &params, eSystem::pushstart_set.color_r, eSystem::pushstart_set.color_g, eSystem::pushstart_set.color_b, eSystem::pushstart_set.p2_align);
160+
}
161+
}
162+
}
163+
164+
if (eCursor::Player2_Character == -1 && !eCursor::Player1_Selected)
165+
{
166+
if (eCursor::Player1_Turns < 1)
167+
{
168+
if (gameModeView_p2 == 0)
169+
{
170+
if (eSystem::GetTimer() & 16)
171+
Draw2DText(eSystem::pushstart_set.text, font, &params2, eSystem::pushstart_set.color_r, eSystem::pushstart_set.color_g, eSystem::pushstart_set.color_b, eSystem::pushstart_set.p1_align);
172+
}
173+
}
174+
175+
}
176+
}
177+
}
178+
}
179+
}
180+
101181
void __declspec(naked) eSelectScreenManager::HookWaitAtCharacterSelect()
102182
{
103183

@@ -153,6 +233,10 @@ void eSelectScreenManager::ProcessWaitPlayer2()
153233
}
154234
}
155235

236+
void eSelectScreenManager::ProcessGameLoopEvent()
237+
{
238+
}
239+
156240
void eSelectScreenManager::HookSelectScreenProcess(int a1, int a2)
157241
{
158242
m_pSelectScreenProcessPointer = a2;
@@ -267,6 +351,103 @@ void __declspec(naked) eSelectScreenManager::HookSelectIDs()
267351

268352
}
269353

354+
void __declspec(naked) eSelectScreenManager::HookCurrentScreenGameData()
355+
{
356+
static int gamedata_done_jmp = 0x408AAA;
357+
_asm {
358+
mov eax, esi
359+
mov m_pGameFlowData, eax
360+
mov esi, 0x40E7C0
361+
call esi
362+
mov esi, m_pGameFlowData
363+
pushad
364+
popad
365+
jmp gamedata_done_jmp
366+
}
367+
}
368+
369+
370+
void eSelectScreenManager::ProcessPlayer2JoinIn()
371+
{
372+
if (!eSystem::pushstart_set.active)
373+
return;
374+
if (eCursor::Player1_Selected || eCursor::Player2_Selected)
375+
return;
376+
if (!eMenuManager::m_pSelectScreenDataPointer)
377+
return;
378+
379+
bool joined = false;
380+
381+
382+
383+
if (eCursor::Player2_Character > -1)
384+
{
385+
if (eInputManager::CheckLastPlayer() == false)
386+
{
387+
if (eInputManager::GetKeyAction(INPUT_ACTION_START))
388+
{
389+
if (!eCursor::Player2_Selected && eCursor::Player2_Turns < 1)
390+
joined = true;
391+
}
392+
}
393+
}
394+
else
395+
{
396+
if (eCursor::Player1_Character > -1)
397+
{
398+
if (eInputManager::CheckLastPlayer() == true)
399+
{
400+
if (eInputManager::GetKeyAction(INPUT_ACTION_START))
401+
{
402+
if (!eCursor::Player1_Selected && eCursor::Player1_Turns < 1)
403+
joined = true;
404+
}
405+
}
406+
}
407+
408+
}
409+
410+
eGameplayModes mode = MODE_VERSUS;
411+
eGameplayModes curMode = (eGameplayModes)eSystem::GetGameplayMode();
412+
413+
switch (curMode)
414+
{
415+
case MODE_ARCADE:
416+
mode = MODE_VERSUS;
417+
break;
418+
case MODE_TEAM_ARCADE:
419+
mode = MODE_TEAM_VERSUS;
420+
break;
421+
default:
422+
mode = MODE_VERSUS;
423+
break;
424+
}
425+
426+
if (joined)
427+
{
428+
// when refreshing screen cursor gets set to starting pos
429+
// so current cursor is saved as setting then reset at select
430+
// screen init
431+
eCursor::StoreCursor();
432+
eSystem::ClearScreenparams(m_pGameFlowData->params);
433+
eSystem::SetGameplayMode(mode);
434+
eSystem::SetScreenParams(m_pGameFlowData->params, mode, 1);
435+
436+
if (eSystem::pushstart_set.group >= 0 && eSystem::pushstart_set.index >= 0)
437+
{
438+
Sound* snd = eSystem::GetSystemSND();
439+
PlaySound(snd, eSystem::pushstart_set.group, eSystem::pushstart_set.index, 0, 3.390625f);
440+
}
441+
442+
if (mode == MODE_VERSUS)
443+
{
444+
*(int*)(eMenuManager::m_pSelectScreenDataPointer + 0x3BA4) = 0;
445+
*(int*)(eMenuManager::m_pSelectScreenDataPointer + 0x3BA4 + 180) = 0;
446+
}
447+
}
448+
449+
}
450+
270451
void eSelectScreenManager::HookLoadCharacterData(char * file)
271452
{
272453
PushDebugMessage(file);

‎source/MugenHook/code/mugenhook/eSelectScreenManager.h

+9
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
#define CHAR_FLAG_ANIM_ICON 8
99

1010

11+
1112
class eSelectScreenManager {
1213
public:
1314
static bool m_bCachedSoundData;
@@ -19,19 +20,27 @@ class eSelectScreenManager {
1920
static int m_pSelectScreenProcessPointer;
2021
static int m_pSelectScreenStringPointer;
2122

23+
static eGameFlowData* m_pGameFlowData;
24+
2225
static std::string m_pSelectScreenLastString;
2326
static eMugenCharacterInfo* m_pCharacter;
2427
static void Init();
2528
static void Process();
29+
static void ProcessEnd();
2630
static void HookWaitAtCharacterSelect();
2731
static void ProcessWaitPlayer1();
2832
static void ProcessWaitPlayer2();
33+
static void ProcessGameLoopEvent();
2934
static void HookSelectScreenProcess(int a1, int a2);
3035
static void PrintCharacterData();
3136
static int ProcessDrawingCharacterFace(int* a1, int a2, int a3, int a4, int a5, int a6, int a7);
3237
static int HookStageNumeration(char* dest, char* format, int dummy, char* name);
3338
static void HookSelectIDs();
3439

40+
static void HookCurrentScreenGameData();
41+
42+
static void ProcessPlayer2JoinIn();
43+
3544
static void HookLoadCharacterData(char* file);
3645
static void HookCacheSoundData();
3746
static void THREAD_CacheSoundData();

‎source/MugenHook/code/mugenhook/eTagFix.cpp

+40
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#include "eTagFix.h"
22
#include "base.h"
33
#include "..\core\eSettingsManager.h"
4+
#include "..\mugen\System.h"
45

56
int eTagFix::m_pParam;
67
int eTagFix::m_nFighters;
@@ -12,7 +13,12 @@ void eTagFix::Init()
1213
if (eSettingsManager::bEnableTagFix)
1314
{
1415
Patch<int>(0x406DA0 + 8, (int)eTagFix::Hook);
16+
1517
InjectHook(0x455961, eTagFix::HookGameModeCommand, PATCH_JUMP);
18+
Nop(0x4245C2, 6);
19+
InjectHook(0x4245C2, eTagFix::HookTeamLifeFix, PATCH_JUMP);
20+
Nop(0x4245EA, 6);
21+
InjectHook(0x4245EA, eTagFix::HookTeamLifeFixP2, PATCH_JUMP);
1622
}
1723

1824
}
@@ -71,3 +77,37 @@ void __declspec(naked) eTagFix::HookGameModeCommand()
7177

7278
}
7379

80+
void __declspec(naked) eTagFix::HookTeamLifeFix()
81+
{
82+
static int teamlife_jmp = 0x4245CA;
83+
static int teamlife_jmp_fail = 0x4245DA;
84+
_asm {
85+
86+
cmp[esi + 0x50AC], 1
87+
je ok
88+
cmp[esi + 0x50AC], 2
89+
je ok
90+
jmp teamlife_jmp_fail
91+
92+
ok:
93+
jmp teamlife_jmp
94+
}
95+
}
96+
97+
void __declspec(naked) eTagFix::HookTeamLifeFixP2()
98+
{
99+
static int teamlife2_jmp = 0x4245F2;
100+
static int teamlife2_jmp_fail = 0x424604;
101+
_asm {
102+
103+
cmp[esi + 0x6B88], 1
104+
je ok
105+
cmp[esi + 0x6B88], 2
106+
je ok
107+
jmp teamlife2_jmp_fail
108+
109+
ok :
110+
jmp teamlife2_jmp
111+
}
112+
}
113+

‎source/MugenHook/code/mugenhook/eTagFix.h

+2
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,6 @@ class eTagFix {
88
static void Init();
99
static void Hook();
1010
static void HookGameModeCommand();
11+
static void HookTeamLifeFix();
12+
static void HookTeamLifeFixP2();
1113
};

0 commit comments

Comments
 (0)
Please sign in to comment.