Skip to content

Commit

Permalink
Fixed: Proper call and file creation settlement
Browse files Browse the repository at this point in the history
Added: All supported addons in workshop ID list
Added: `ExportPanelDB` Writes the track type before every set
Improved: Pieces manager. Increase stack depth to 50K
Removed: Repeating define `SSTACK_STRLN`
  • Loading branch information
dvdvideo1234 committed Nov 9, 2023
1 parent 09a4ce8 commit fe21bfc
Show file tree
Hide file tree
Showing 7 changed files with 100 additions and 70 deletions.
124 changes: 75 additions & 49 deletions data/trackassembly/tools/peaces_manager/emd.bat
Original file line number Diff line number Diff line change
Expand Up @@ -30,45 +30,67 @@ set emd_chew_dbase=%emd_chew_gmod%\garrysmod\data\trackassembly\exp\trackasmlib_
set emd_chew_skip=%emd_chew_repo%\data\trackassembly\tools\peaces_manager\models_ignored.txt

:: How many addons are to be processed
set emd_chew_addcnt=17
set emd_chew_addcnt=28

:: GMA addons to be processed
set emd_chew_addlst[1]=149759773
set emd_chew_addlst[2]=147812851
set emd_chew_addlst[3]=132843280
set emd_chew_addlst[4]=173482196
set emd_chew_addlst[5]=290130567
set emd_chew_addlst[6]=326640186
set emd_chew_addlst[7]=173717507
set emd_chew_addlst[8]=331192490
set emd_chew_addlst[9]=517442747
set emd_chew_addlst[10]=718239260
set emd_chew_addlst[11]=728833183
set emd_chew_addlst[12]=807162936
set emd_chew_addlst[13]=740453553
set emd_chew_addlst[14]=1658816805
set emd_chew_addlst[15]=1888013789
set emd_chew_addlst[16]=1955876643
set emd_chew_addlst[17]=3071058065
set emd_chew_addlst[1]=740453553
set emd_chew_addlst[2]=2194528273
set emd_chew_addlst[3]=807162936
set emd_chew_addlst[4]=489114511
set emd_chew_addlst[5]=180210973
set emd_chew_addlst[6]=718239260
set emd_chew_addlst[7]=XXX
set emd_chew_addlst[8]=1658816805
set emd_chew_addlst[9]=290130567
set emd_chew_addlst[10]=1336622735
set emd_chew_addlst[11]=2340192251
set emd_chew_addlst[12]=590574800
set emd_chew_addlst[13]=517442747
set emd_chew_addlst[14]=1512053748
set emd_chew_addlst[15]=343061215
set emd_chew_addlst[16]=634000136
set emd_chew_addlst[17]=865735701
set emd_chew_addlst[18]=728833183
set emd_chew_addlst[19]=173482196
set emd_chew_addlst[20]=326640186
set emd_chew_addlst[21]=147812851
set emd_chew_addlst[22]=149759773
set emd_chew_addlst[23]=173717507
set emd_chew_addlst[24]=132843280
set emd_chew_addlst[25]=147812851
set emd_chew_addlst[26]=331192490
set emd_chew_addlst[27]=1888013789
set emd_chew_addlst[28]=1955876643

:: Folder list for extraction and the directories they will be extracted
set emd_chew_adddir[1]=SligWolf's Minitrains
set emd_chew_adddir[2]=SligWolf's Minihover$SligWolf's White Rails
set emd_chew_adddir[3]=SligWolf's Rerailers
set emd_chew_adddir[4]=SProps
set emd_chew_adddir[5]=Magnum's Rails
set emd_chew_adddir[6]=Shinji85's Rails
set emd_chew_adddir[7]=SligWolf's Railcar
set emd_chew_adddir[8]=StevenTechno's Buildings 1.0
set emd_chew_adddir[9]=Mr.Train's M-Gauge
set emd_chew_adddir[10]=G Scale Track Pack
set emd_chew_adddir[11]=Ron's Minitrain Props
set emd_chew_adddir[12]=Battleship's abandoned rails
set emd_chew_adddir[13]=AlexCookie's 2ft track pack
set emd_chew_adddir[14]=Joe's track pack
set emd_chew_adddir[15]=StevenTechno's Buildings 2.0
set emd_chew_adddir[16]=Trackmania United Props
set emd_chew_adddir[17]=Fortification Collection
set emd_chew_adddir[1]=AlexCookie's 2ft track pack
set emd_chew_adddir[2]=Anyone's Horrible Trackpack
set emd_chew_adddir[3]=Battleship's abandoned rails
set emd_chew_adddir[4]=Bobster's two feet rails
set emd_chew_adddir[5]=CAP Walkway
set emd_chew_adddir[6]=G Scale Track Pack
set emd_chew_adddir[7]=Joe's 2ft track pack
set emd_chew_adddir[8]=Joe's track pack
set emd_chew_adddir[9]=Magnum's Rails
set emd_chew_adddir[10]=Modular Canals
set emd_chew_adddir[11]=Modular Sewer
set emd_chew_adddir[12]=Mr.Train's G-Gauge
set emd_chew_adddir[13]=Mr.Train's M-Gauge
set emd_chew_adddir[14]=Plarail
set emd_chew_adddir[15]=Random Bridges
set emd_chew_adddir[16]=Ron's 2ft track pack
set emd_chew_adddir[17]=Ron's G Scale Track pack
set emd_chew_adddir[18]=Ron's Minitrain Props
set emd_chew_adddir[19]=SProps
set emd_chew_adddir[20]=Shinji85's Rails
set emd_chew_adddir[21]=SligWolf's Minihover
set emd_chew_adddir[22]=SligWolf's Minitrains
set emd_chew_adddir[23]=SligWolf's Railcar
set emd_chew_adddir[24]=SligWolf's Rerailers
set emd_chew_adddir[25]=SligWolf's White Rails
set emd_chew_adddir[26]=StevenTechno's Buildings 1.0
set emd_chew_adddir[27]=StevenTechno's Buildings 2.0
set emd_chew_adddir[28]=Trackmania United Props

:: Show the current folder
echo Running in: %emd_chew_pathb%
Expand All @@ -78,18 +100,25 @@ set emd_chew_modls=models_list
set emd_clog_lfile=system_log

:: Refresh model report
del %emd_chew_pathb%%emd_chew_modls%.txt
del %emd_chew_pathb%%emd_clog_lfile%.txt
echo Refresh model report!
IF EXIST "%emd_chew_pathb%%emd_chew_modls%.txt" ( call del %emd_chew_pathb%%emd_chew_modls%.txt )
IF EXIST "%emd_chew_pathb%%emd_clog_lfile%.txt" ( call del %emd_chew_pathb%%emd_clog_lfile%.txt )

:: Refresh output files
echo Refresh output files!
IF EXIST "%emd_chew_pathb%addon-db.txt" ( del %emd_chew_pathb%addon-db.txt )
IF EXIST "%emd_chew_pathb%db-addon.txt" ( del %emd_chew_pathb%db-addon.txt )

:: Extract the GMA addons in the matching folders
echo Extract the GMA addons in the matching folders!
for /L %%k in (1,1,%emd_chew_addcnt%) do (
set /A emd_chew_match=0
:: Try the addons folder
IF !emd_chew_match! EQU 0 (
:: Extract addon info
set "emd_chew_fdid=!emd_chew_addlst[%%k]!"
set "emd_chew_fdnm=!emd_chew_adddir[%%k]!"
:: Create search path
:: Create search path
set emd_chew_fgma=!emd_chew_addon!\*
set emd_chew_fgma=!emd_chew_fgma!!emd_chew_fdid!*
set emd_chew_fgma=!emd_chew_fgma!.!emd_chew_adext!
Expand All @@ -98,9 +127,9 @@ for /L %%k in (1,1,%emd_chew_addcnt%) do (
set /A emd_chew_match=1
:: Extract the GMA in the current folder
cd %emd_chew_pathb%
IF EXIST "!emd_chew_fdnm!\" ( rd /S /Q "!emd_chew_fdnm!" )
IF EXIST "!emd_chew_fdnm!\" ( call rd /S /Q "!emd_chew_fdnm!" )
call %emd_chew_binloc%\gmad.exe extract -file "%%i" -out "%emd_chew_pathb%!emd_chew_fdnm!" >> %emd_clog_lfile%.txt
echo Addons: [%%k]{!emd_chew_fdnm!} @ %TIME%
echo A: [%%k]{!emd_chew_fdnm!} @ %TIME%
)
)
:: Try the workshop content folder
Expand All @@ -116,26 +145,23 @@ for /L %%k in (1,1,%emd_chew_addcnt%) do (
set /A emd_chew_match=1
:: Extract the GMA in the current folder
cd %emd_chew_pathb%
IF EXIST "!emd_chew_fdnm!\" ( rd /S /Q "!emd_chew_fdnm!" )
IF EXIST "!emd_chew_fdnm!\" ( call rd /S /Q "!emd_chew_fdnm!" )
call %emd_chew_binloc%\gmad.exe extract -file "%%i" -out "%emd_chew_pathb%!emd_chew_fdnm!" >> %emd_clog_lfile%.txt
echo Workshop: [%%k]{!emd_chew_fdnm!} @ %TIME%
echo W: [%%k]{!emd_chew_fdnm!} @ %TIME%
)
)
:: Try the workshop content folder
IF !emd_chew_match! EQU 0 (
echo Not-Available: [%%k]{!emd_chew_fdnm!} @ %TIME%
echo X: [%%k]{!emd_chew_fdnm!} @ %TIME%
)
)

:: Get all the model files in the current directory
dir /a-d /b /s *.mdl >> %emd_chew_pathb%%emd_chew_modls%.txt

:: Refresh output files
del %emd_chew_pathb%addon-db.txt
del %emd_chew_pathb%db-addon.txt
echo Read model files in the current directory!
call dir /a-d /b /s *.mdl >> %emd_chew_pathb%%emd_chew_modls%.txt

:: Chewing the paths uses base path relative to the executable
echo Rinning pieces manager
echo Chewing the paths uses base path relative to the executable!
call %emd_chew_pathb%peaces_manager.exe %emd_chew_pathb% %emd_chew_dbase% %emd_chew_skip% %emd_clog_lfile%

timeout 300
15 changes: 11 additions & 4 deletions data/trackassembly/tools/peaces_manager/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,19 @@ int main(int argc, char **argv)
{
/* Only for test ! */
/*
argc: <5>
argv[0]=<G:\Documents\CodeBlocks-Projs\peaces_manager\bin\peaces_manager.exe>
argv[1]=<G:\Documents\CodeBlocks-Projs\peaces_manager\bin\>
argv[2]=<D:\Games\Steam\steamapps\common\GarrysMod\garrysmod\data\trackassembly\exp\trackasmlib_db.txt>
argv[3]=<D:\Games\Steam\steamapps\common\GarrysMod\garrysmod\addons\TrackAssemblyTool_GIT\data\trackassembly\tools\peaces_manager\models_ignored.txt>
argv[4]=<system_log>
int argc = 5;
char argv[5][500];
strcpy(argv[0], "O:\\Documents\\CodeBlocks-Projs\\peaces_manager\\bin\\peaces_manager.exe");
strcpy(argv[1], "O:\\Documents\\CodeBlocks-Projs\\peaces_manager\\bin\\");
strcpy(argv[2], "F:\\Games\\Steam\\steamapps\\common\\GarrysMod\\garrysmod\\data\\trackassembly\\trackasmlib_db.txt");
strcpy(argv[3], "F:\\Games\\Steam\\steamapps\\common\\GarrysMod\\garrysmod\\addons\\TrackAssemblyTool_GIT\\data\\peaces_manager\\models_ignored.txt");
strcpy(argv[0], "G:\\Documents\\CodeBlocks-Projs\\peaces_manager\\bin\\peaces_manager.exe");
strcpy(argv[1], "G:\\Documents\\CodeBlocks-Projs\\peaces_manager\\bin\\");
strcpy(argv[2], "D:\\Games\\Steam\\steamapps\\common\\GarrysMod\\garrysmod\\data\\trackassembly\\exp\\trackasmlib_db.txt");
strcpy(argv[3], "D:\\Games\\Steam\\steamapps\\common\\GarrysMod\\garrysmod\\addons\\TrackAssemblyTool_GIT\\data\\trackassembly\\tools\\peaces_manager\\models_ignored.txt");
strcpy(argv[4], "system_log");
*/
stentry::cEntryStack Ignored;
Expand Down
8 changes: 1 addition & 7 deletions data/trackassembly/tools/peaces_manager/peaces_manager.cbp
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,11 @@
<Add option="-fexceptions" />
</Compiler>
<Unit filename="common.h" />
<Unit filename="emd.bat" />
<Unit filename="main.cpp" />
<Unit filename="main.h" />
<Unit filename="models_ignored.txt" />
<Unit filename="string_stack.h" />
<Unit filename="struct_entry.h" />
<Unit filename="struct_match.h" />
<Extensions>
<code_completion />
<envvars />
<debugger />
</Extensions>
<Extensions />
</Project>
</CodeBlocks_project_file>
4 changes: 2 additions & 2 deletions data/trackassembly/tools/peaces_manager/string_stack.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#define __STRING_STACK_H_

#define SSTACK_STRLN 500
#define SSTACK_DEPTH 10000
#define SSTACK_DEPTH 50000
#define SSTACK_SUCCESS 0
#define SSTACK_INVALID_ID -1
#define SSTACK_MALLOC_FAIL -2
Expand Down Expand Up @@ -116,7 +116,7 @@
strOther = Other->getString(oItem);
if(NULL != strOther)
{
// fprintf(File,"Try: #%d <%s> # <%s>\n",AdID,AdName,strOther->Data);
// fprintf(File,"Try: #%d <%s> --> <%s>\n",AdID,AdName,strOther->Data);
iStatus = findStringID(0,strOther->Data);
if(SSTACK_NOT_FOUND == iStatus)
{
Expand Down
8 changes: 3 additions & 5 deletions data/trackassembly/tools/peaces_manager/struct_entry.h
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
#ifndef __STRING_STACK_H_
#define __STRING_STACK_H_
// The maximum string length for a item
#define SSTACK_STRLN 300
// String creator name length
#define SSTACK_STRLN 300
#define SSTACK_STRLN 500
// How deep is the stack
#define SSTACK_DEPTH 5000
#define SSTACK_DEPTH 50000
// Type used for storing booleans
// 0 -> Ignored by cross-add from the same creator
#define SSTACK_TYPE_FLAGS unsigned char
Expand Down Expand Up @@ -165,7 +163,7 @@
enOther = Other->getEntry(oItem);
if(SSTACK_INV_POINTER != enOther)
{
common::logSystem(fLog,"printMismatch: Found #%d <%s> # <%s>",AdID,AdName,enOther->Data);
common::logSystem(fLog,"printMismatch: Found #%d <%s> --> <%s>",AdID,AdName,enOther->Data);
stErr = findEntryID(0,enOther->Data,&gItem);
if(SSTACK_NOT_FOUND == stErr)
{
Expand Down
2 changes: 1 addition & 1 deletion lua/autorun/trackassembly_init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ local asmlib = trackasmlib; if(not asmlib) then -- Module present
------------ CONFIGURE ASMLIB ------------

asmlib.InitBase("track","assembly")
asmlib.SetOpVar("TOOL_VERSION","8.733")
asmlib.SetOpVar("TOOL_VERSION","8.734")
asmlib.SetIndexes("V" ,1,2,3)
asmlib.SetIndexes("A" ,1,2,3)
asmlib.SetIndexes("WV",1,2,3)
Expand Down
9 changes: 7 additions & 2 deletions lua/trackassembly/trackasmlib.lua
Original file line number Diff line number Diff line change
Expand Up @@ -3128,19 +3128,24 @@ end
]]
local function ExportPanelDB(stPanel, bExp, makTab, sFunc)
if(bExp) then
local sMiss = GetOpVar("MISS_NOAV")
local sExpo = GetOpVar("DIRPATH_EXP")
local sMoDB = GetOpVar("MODE_DATABASE")
local symSep = GetOpVar("OPSYM_SEPARATOR")
local symSep, cT = GetOpVar("OPSYM_SEPARATOR")
local iCnt, sBase = 1, GetOpVar("DIRPATH_BAS")
if(not fileExists(sBase, "DATA")) then fileCreateDir(sBase) end
local fName = (sBase..sExpo..GetOpVar("NAME_LIBRARY").."_db.txt")
local F = fileOpen(fName, "wb" ,"DATA"); if(not F) then
local F = fileOpen(fName, "wb" ,"DATA"), sMiss; if(not F) then
LogInstance("Open fail "..GetReport1(fName)); return stPanel end
F:Write("# "..sFunc..":("..tostring(bExp)..") "..GetDateTime().." [ "..sMoDB.." ]\n")
while(stPanel[iCnt]) do local vPanel = stPanel[iCnt]
local sM = vPanel[makTab:GetColumnName(1)]
local sT = vPanel[makTab:GetColumnName(2)]
local sN = vPanel[makTab:GetColumnName(3)]
if(not cT or cT ~= sT) then -- Category has been changed
F:Write("# Categorize [ "..sMoDB.." ]("..sT.."): "..tostring(WorkshopID(sT) or sMiss))
F:Write("\n"); cT = sT -- Cashe category name
end -- Otherwise just wite down the piece active point
F:Write("\""..sM.."\""..symSep.."\""..sT.."\""..symSep.."\""..sN.."\"")
F:Write("\n"); iCnt = iCnt + 1
end; F:Flush(); F:Close()
Expand Down

0 comments on commit fe21bfc

Please sign in to comment.