Skip to content

Commit

Permalink
Revert "Add script function name length check"
Browse files Browse the repository at this point in the history
This reverts commit ecf9549.
Probably should not suddenly push a breaking change like this LOL
  • Loading branch information
MegAmi24 committed Sep 29, 2024
1 parent ecf9549 commit d984b85
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 66 deletions.
63 changes: 0 additions & 63 deletions RSDKv4/Script.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2878,27 +2878,6 @@ void ParseScriptFile(char *scriptName, int scriptID)
}

if (scriptFunctionCount < FUNCTION_COUNT && funcID == -1) {
#if !RETRO_USE_ORIGINAL_CODE
if (StrLength(funcName) >= FUNCTION_NAME_LIMIT) {
SetupTextMenu(&gameMenu[0], 0);
AddTextMenuEntry(&gameMenu[0], "SCRIPT PARSING FAILED");
AddTextMenuEntry(&gameMenu[0], " ");
AddTextMenuEntry(&gameMenu[0], "FUNCTION NAME TOO LONG");
AddTextMenuEntry(&gameMenu[0], funcName);
AddTextMenuEntry(&gameMenu[0], " ");
AddTextMenuEntry(&gameMenu[0], "LINE NUMBER");
char buffer[0x10];
buffer[0] = 0;
AppendIntegerToString(buffer, lineID);
AddTextMenuEntry(&gameMenu[0], buffer);
AddTextMenuEntry(&gameMenu[0], " ");
AddTextMenuEntry(&gameMenu[0], "ERROR IN");
AddTextMenuEntry(&gameMenu[0], scriptName);
Engine.gameMode = ENGINE_SCRIPTERROR;
return;
}
#endif

StrCopy(scriptFunctionList[scriptFunctionCount++].name, funcName);
}
else {
Expand All @@ -2923,27 +2902,6 @@ void ParseScriptFile(char *scriptName, int scriptID)
parseMode = PARSEMODE_SCOPELESS;
}
else {
#if !RETRO_USE_ORIGINAL_CODE
if (StrLength(funcName) >= FUNCTION_NAME_LIMIT) {
SetupTextMenu(&gameMenu[0], 0);
AddTextMenuEntry(&gameMenu[0], "SCRIPT PARSING FAILED");
AddTextMenuEntry(&gameMenu[0], " ");
AddTextMenuEntry(&gameMenu[0], "FUNCTION NAME TOO LONG");
AddTextMenuEntry(&gameMenu[0], funcName);
AddTextMenuEntry(&gameMenu[0], " ");
AddTextMenuEntry(&gameMenu[0], "LINE NUMBER");
char buffer[0x10];
buffer[0] = 0;
AppendIntegerToString(buffer, lineID);
AddTextMenuEntry(&gameMenu[0], buffer);
AddTextMenuEntry(&gameMenu[0], " ");
AddTextMenuEntry(&gameMenu[0], "ERROR IN");
AddTextMenuEntry(&gameMenu[0], scriptName);
Engine.gameMode = ENGINE_SCRIPTERROR;
return;
}
#endif

StrCopy(scriptFunctionList[scriptFunctionCount].name, funcName);
scriptFunctionList[scriptFunctionCount].access = ACCESS_PUBLIC;
scriptFunctionList[scriptFunctionCount].ptr.scriptCodePtr = scriptCodePos;
Expand Down Expand Up @@ -2982,27 +2940,6 @@ void ParseScriptFile(char *scriptName, int scriptID)
parseMode = PARSEMODE_SCOPELESS;
}
else {
#if !RETRO_USE_ORIGINAL_CODE
if (StrLength(funcName) >= FUNCTION_NAME_LIMIT) {
SetupTextMenu(&gameMenu[0], 0);
AddTextMenuEntry(&gameMenu[0], "SCRIPT PARSING FAILED");
AddTextMenuEntry(&gameMenu[0], " ");
AddTextMenuEntry(&gameMenu[0], "FUNCTION NAME TOO LONG");
AddTextMenuEntry(&gameMenu[0], funcName);
AddTextMenuEntry(&gameMenu[0], " ");
AddTextMenuEntry(&gameMenu[0], "LINE NUMBER");
char buffer[0x10];
buffer[0] = 0;
AppendIntegerToString(buffer, lineID);
AddTextMenuEntry(&gameMenu[0], buffer);
AddTextMenuEntry(&gameMenu[0], " ");
AddTextMenuEntry(&gameMenu[0], "ERROR IN");
AddTextMenuEntry(&gameMenu[0], scriptName);
Engine.gameMode = ENGINE_SCRIPTERROR;
return;
}
#endif

StrCopy(scriptFunctionList[scriptFunctionCount].name, funcName);
scriptFunctionList[scriptFunctionCount].access = ACCESS_PRIVATE;
scriptFunctionList[scriptFunctionCount].ptr.scriptCodePtr = scriptCodePos;
Expand Down
4 changes: 1 addition & 3 deletions RSDKv4/Script.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@
#define FUNCSTACK_COUNT (0x400)
#define FORSTACK_COUNT (0x400)

#define FUNCTION_NAME_LIMIT (0x20)

#define RETRO_USE_COMPILER (1)

struct ScriptPtr {
Expand All @@ -22,7 +20,7 @@ struct ScriptFunction {

byte access;
#if RETRO_USE_COMPILER
char name[FUNCTION_NAME_LIMIT];
char name[0x20];
#endif
ScriptPtr ptr;
};
Expand Down

0 comments on commit d984b85

Please sign in to comment.