Skip to content

Commit

Permalink
Added CSV seperation in config.
Browse files Browse the repository at this point in the history
  • Loading branch information
LordDraXula committed May 19, 2021
1 parent ac0a540 commit 863c409
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 3 deletions.
17 changes: 15 additions & 2 deletions Sys/Scripts/MKW/CSV_Handler.lua
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,14 @@ local function loadCSV(csvFileName)
end

for line in io.lines(csvFileName) do
local aB, bB, lB, hI, vI, dP = line:match("(%d*),(%d*),(%d*),%s*(.-),%s*(.-),(%d*)")
local matchString = "(%d*)%" .. config.csvSeperator ..
"(%d*)%" .. config.csvSeperator ..
"(%d*)%" .. config.csvSeperator ..
"(%-?%d+)%" .. config.csvSeperator ..
"(%-?%d+)%" .. config.csvSeperator ..
"(%d*)"
-- local aB, bB, lB, hI, vI, dP = line:match("(%d*)%,(%d*)%,(%d*)%,%s*(.-)%,%s*(.-)%,(%d*)")
local aB, bB, lB, hI, vI, dP = line:match(matchString)
hI = hI + subtractiveStick
vI = vI + subtractiveStick
inputList[#inputList + 1] = {tonumber(aB), tonumber(bB), tonumber(lB), hI, vI, tonumber(dP)}
Expand Down Expand Up @@ -53,7 +60,13 @@ local function writeCSV(csvFileName, inputTable)
end

for _, inputs in ipairs(inputTable) do
local outputString = string.format("%u,%u,%u,%d,%d,%u\n", inputs[1], inputs[2], inputs[3],
local matchString = "%u" .. config.csvSeperator ..
"%u" .. config.csvSeperator ..
"%u" .. config.csvSeperator ..
"%d" .. config.csvSeperator ..
"%d" .. config.csvSeperator ..
"%u\n"
local outputString = string.format(matchString, inputs[1], inputs[2], inputs[3],
inputs[4] + subtractiveStick, inputs[5] + subtractiveStick, inputs[6])
io.write(outputString)
end
Expand Down
5 changes: 4 additions & 1 deletion Sys/Scripts/config/TASToolKit_config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ TTK_config.useRbutton = false
-- set to 0 to disable backups
TTK_config.backupAmount = 8

-- uses defined char for csv row seperation
TTK_config.csvSeperator = ','

TTK_config.textFilePath = {
player = "MKW_Inputs/MKW_Player_Inputs.csv",
ghost = "MKW_Inputs/MKW_Ghost_Inputs.csv",
Expand All @@ -20,7 +23,7 @@ TTK_config.textFilePath = {
-- if (createRKSYScopy): read originalRksysPath -> insert created rkg into download slot on license 1 -> save to rksysCopyFilePath
TTK_config.saveProgress = {
rkgFilePath = "MKW_Inputs/MKW_Player_Inputs.rkg",
createRKSYScopy = true,
createRKSYScopy = false,
rksysCopyFilePath = "MKW_Inputs/rksys.dat",
originalRksysPath = "User/Wii/title/00010004/524d4345/data/rksys.dat"
}
Expand Down

0 comments on commit 863c409

Please sign in to comment.