@@ -521,19 +521,6 @@ BOOL FIXAPI hk_call_12E852C(HWND RichEditControl, LPCSTR Text)
521521}
522522
523523
524-
525- /*
526- ==================
527- hk_first_call_strtok_for_quote
528- ==================
529- */
530- LPSTR FIXAPI hk_first_call_strtok_for_quote (LPSTR lpSrc, LPCSTR lpDelim)
531- {
532- return strtok (lpSrc, " \" " );
533- }
534-
535-
536-
537524/*
538525==================
539526hk_call_2511176
@@ -747,14 +734,6 @@ VOID FIXAPI PatchMessage(VOID)
747734 Core::Classes::UI::CUIMainWindow::ProcessMessages ();
748735}
749736
750-
751- VOID FIXAPI HiddenMovableStatic (BOOL Value)
752- {
753- LPVOID ptrArr = *((LPVOID*)OFFSET (0x6D54CF8 , 0 ));
754- ((VOID (__fastcall*)(LPVOID, INT32, BOOL))OFFSET (0x7B4520 , 0 ))(ptrArr, 0 , Value);
755- ((VOID (__fastcall*)(VOID))OFFSET (0x59C820 , 0 ))();
756- }
757-
758737VOID FIXAPI PatchTemplatedFormIterator (VOID)
759738{
760739 class FormIteratorHook : public Xbyak ::CodeGenerator
@@ -828,4 +807,196 @@ VOID FIXAPI PatchTemplatedFormIterator(VOID)
828807 FormIteratorHook::Generate (OFFSET (0x191D2 , 0 ));
829808 FormIteratorHook::Generate (OFFSET (0x28CBD , 0 ));
830809 FormIteratorHook::Generate (OFFSET (0x118FB , 0 ));
810+ }
811+
812+
813+ /*
814+ ==================
815+ PatchGeneratePreCombined_CmdLineWithQuote
816+
817+ Adds support for quotation marks of some commands on the command line
818+ ==================
819+ */
820+
821+ LPSTR FIXAPI Fixed_StrTok (LPSTR str, LPSTR delim, LPSTR* next_token)
822+ {
823+ if (str)
824+ {
825+ while (*str == ' ' )
826+ {
827+ if (*str == ' \0 ' )
828+ return NULL ;
829+
830+ str++;
831+ }
832+
833+ if (*str == ' \" ' )
834+ return strtok_s (++str, " \" " , next_token);
835+ else
836+ return strtok_s (str, " " , next_token);
837+ }
838+ else if (next_token && *next_token)
839+ {
840+ if (strchr (*next_token, ' \" ' ))
841+ {
842+ LPSTR lpRes = strtok_s (NULL , " \" " , next_token);
843+
844+ if (lpRes && !XUtil::Str::trim (lpRes).length ())
845+ lpRes = strtok_s (NULL , " \" " , next_token);
846+
847+ return lpRes;
848+ }
849+ else
850+ return strtok_s (NULL , " " , next_token);
851+ }
852+ else
853+ return strtok_s (str, delim, next_token);
854+ };
855+
856+ VOID FIXAPI RestoreGenerateSingleLip (LPSTR lpCmdLine, LPSTR arg2)
857+ {
858+ namespace fs = std::filesystem;
859+
860+ LPSTR next_token = NULL ;
861+
862+ LPSTR token = Fixed_StrTok (lpCmdLine, " " , &next_token);
863+ if (token)
864+ {
865+ LPSTR filename = token;
866+ token = Fixed_StrTok (NULL , " " , &next_token);
867+ if (token)
868+ {
869+ auto pathAudioFile = fs::path (filename);
870+ // Replacement by .wav
871+ pathAudioFile.replace_extension (L" .wav" );
872+
873+ if (fs::exists (pathAudioFile))
874+ {
875+ auto AudioFilePath = XUtil::Conversion::WideToAnsi (pathAudioFile);
876+ ((BOOL (__fastcall*)(HWND, LPCSTR, LPCSTR))OFFSET (0x0B66BF0 , 0 ))(MainWindow::GetWindow (), AudioFilePath.c_str (), token);
877+
878+ return ;
879+ }
880+ }
881+ }
882+
883+ ((VOID (__fastcall*)(LPCSTR))OFFSET (0x2001A90 , 0 ))(((LPSTR)OFFSET (0x3837940 , 0 )));
884+ }
885+
886+ VOID FIXAPI PatchCmdLineWithQuote (VOID)
887+ {
888+ // Add support quote to command line with -GeneratePreCombined
889+ // Should be: -GeneratePreCombined:"<ESMFilename>" [clean, filtered] [all, other, main, ints]
890+
891+ XUtil::DetourCall (OFFSET (0x33B9D3 , 0 ), &Fixed_StrTok);
892+ XUtil::DetourCall (OFFSET (0x33B9F3 , 0 ), &Fixed_StrTok);
893+ XUtil::DetourCall (OFFSET (0x33BA0C , 0 ), &Fixed_StrTok);
894+
895+ // -GeneratePreVisData
896+ // This command into the code section -GeneratePreCombined.
897+ // Should be: -GeneratePreVisData:"<ESMFilename>" [clean, filtered] [all, other, main, ints]
898+
899+ XUtil::DetourCall (OFFSET (0x33BB0E , 0 ), &Fixed_StrTok);
900+ XUtil::DetourCall (OFFSET (0x33BB2C , 0 ), &Fixed_StrTok);
901+
902+ // Add support quote to command line with -CheckInPlugin
903+ // Should be: -CheckInPlugin:"<PluginFilename>" "<ESMFilename>"
904+
905+ XUtil::DetourCall (OFFSET (0x33B30B , 0 ), &Fixed_StrTok);
906+ XUtil::DetourCall (OFFSET (0x33B32D , 0 ), &Fixed_StrTok);
907+
908+ // Add support quote to command line with -ConvertToESL
909+ // Should be: -ConvertToESL:"<PluginFilename>"
910+
911+ XUtil::DetourCall (OFFSET (0x33C4F4 , 0 ), &Fixed_StrTok);
912+
913+ // Add support quote to command line with -DumpNeededFiles
914+ // Should be: -DumpNeededFiles:"<ESMFilename>" "<OutputFilepath>"
915+
916+ XUtil::DetourCall (OFFSET (0x33B43E , 0 ), &Fixed_StrTok);
917+ XUtil::DetourCall (OFFSET (0x33B45C , 0 ), &Fixed_StrTok);
918+
919+ // Add support quote to command line with -SaveDefaultPlugin
920+ // Should be: -SaveDefaultPlugin:"<PluginFilename>" "<ESMFilename>"
921+
922+ XUtil::DetourCall (OFFSET (0x33B278 , 0 ), &Fixed_StrTok);
923+ XUtil::DetourCall (OFFSET (0x33B296 , 0 ), &Fixed_StrTok);
924+
925+ // Add support quote to command line with -SaveDefaultPlugin
926+ // Should be: -ExportDismemberData:"<ESMFilename>" <XB1|X64|PS4|W32>
927+
928+ XUtil::DetourCall (OFFSET (0x33B1A4 , 0 ), &Fixed_StrTok);
929+ XUtil::DetourCall (OFFSET (0x33B1C2 , 0 ), &Fixed_StrTok);
930+
931+ // Add support quote to command line with -UpdateModelData
932+ // Should be: -UpdateModelData:"<ESMFilename>"
933+
934+ XUtil::DetourCall (OFFSET (0x33B139 , 0 ), &Fixed_StrTok);
935+
936+ // Add support quote to command line with -OutputAreaArt
937+ // Should be: -OutputAreaArt:"<ESMFilename>" "<AreasFilename>" "<OutputFilename>"
938+
939+ XUtil::DetourCall (OFFSET (0x33B07F , 0 ), &Fixed_StrTok);
940+ XUtil::DetourCall (OFFSET (0x33B09D , 0 ), &Fixed_StrTok);
941+ XUtil::DetourCall (OFFSET (0x33B0BB , 0 ), &Fixed_StrTok);
942+
943+ // Add support quote to command line with -CompileTextExport
944+ // Should be: -CompileTextExport:"<ESMFilename>" "<language>" "<PathToTextExport>" ["<PathBackupToTextExport>"]
945+
946+ XUtil::DetourCall (OFFSET (0x33AF37 , 0 ), &Fixed_StrTok);
947+ XUtil::DetourCall (OFFSET (0x33AF55 , 0 ), &Fixed_StrTok);
948+
949+ // Add support quote to command line with -ExportFaceGenData
950+ // Should be: -ExportFaceGenData:"<ESMFilename>" <XB1|X64|PS4|W32>
951+
952+ XUtil::DetourCall (OFFSET (0x33ADD1 , 0 ), &Fixed_StrTok);
953+ XUtil::DetourCall (OFFSET (0x33ADEF , 0 ), &Fixed_StrTok);
954+
955+ // Add support quote to command line with -GenerateAnimInfo
956+ // Should be: -GenerateAnimInfo:"<ESMFilename>" "<DataFilepath>" "<OutputFilepath>" [%s] [%s] [%s]
957+
958+ XUtil::DetourCall (OFFSET (0x33B4DA , 0 ), &Fixed_StrTok);
959+ XUtil::DetourCall (OFFSET (0x33B4F8 , 0 ), &Fixed_StrTok);
960+ XUtil::DetourCall (OFFSET (0x33B516 , 0 ), &Fixed_StrTok);
961+ XUtil::DetourCall (OFFSET (0x33B534 , 0 ), &Fixed_StrTok);
962+ XUtil::DetourCall (OFFSET (0x33B694 , 0 ), &Fixed_StrTok);
963+
964+ // Add support quote to command line with -GenerateSingleLip
965+ // Should be: -GenerateSingleLip:"<WavFilename>" "<Text>"
966+ // Warning: /Data/Sound/ this is the directory relative to which it will be stored .lip file.
967+
968+ XUtil::DetourCall (OFFSET (0x33B843 , 0 ), &RestoreGenerateSingleLip);
969+
970+ // Add support quote to command line with -GenerateStaticCollections
971+ // Should be: -GenerateStaticCollections:"<ESMFilename>" <XB1|X64|PS4|W32>
972+
973+ XUtil::DetourCall (OFFSET (0x33B90E , 0 ), &Fixed_StrTok);
974+ XUtil::DetourCall (OFFSET (0x33B92C , 0 ), &Fixed_StrTok);
975+
976+ // Add support quote to command line with -DepersistRefs
977+ // Should be: -DepersistRefs:"<ESMFilename>"
978+
979+ XUtil::DetourCall (OFFSET (0x33BE82 , 0 ), &Fixed_StrTok);
980+
981+ // Add support quote to command line with -MapMarker
982+ // Should be: -MapMarker:"<ESMFilename>" "<Worldspace|Interior>"
983+
984+ XUtil::DetourCall (OFFSET (0x33BEFE , 0 ), &Fixed_StrTok);
985+ XUtil::DetourCall (OFFSET (0x33BF1C , 0 ), &Fixed_StrTok);
986+
987+ // Add support quote to command line with -MapInfo
988+ // Should be: -MapInfo:"<ESMFilename>" "<Worldspace|Interior>" ["<%s>"]
989+
990+ XUtil::DetourCall (OFFSET (0x33BF87 , 0 ), &Fixed_StrTok);
991+ XUtil::DetourCall (OFFSET (0x33BFA5 , 0 ), &Fixed_StrTok);
992+ XUtil::DetourCall (OFFSET (0x33BFC3 , 0 ), &Fixed_StrTok);
993+
994+ // Add support quote to command line with -ImportScalingData
995+ // Should be: -ImportScalingData:"<ESMFilename>"
996+
997+ XUtil::DetourCall (OFFSET (0x33C10D , 0 ), &Fixed_StrTok);
998+
999+
1000+
1001+
8311002}
0 commit comments