From 863c409976bae3451e54e6032e3189287b2bddd9 Mon Sep 17 00:00:00 2001 From: DraXula Date: Wed, 19 May 2021 14:25:50 +0200 Subject: [PATCH] Added CSV seperation in config. --- Sys/Scripts/MKW/CSV_Handler.lua | 17 +++++++++++++++-- Sys/Scripts/config/TASToolKit_config.lua | 5 ++++- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/Sys/Scripts/MKW/CSV_Handler.lua b/Sys/Scripts/MKW/CSV_Handler.lua index e5ab014..12340df 100644 --- a/Sys/Scripts/MKW/CSV_Handler.lua +++ b/Sys/Scripts/MKW/CSV_Handler.lua @@ -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)} @@ -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 diff --git a/Sys/Scripts/config/TASToolKit_config.lua b/Sys/Scripts/config/TASToolKit_config.lua index e80b5e6..778e21a 100644 --- a/Sys/Scripts/config/TASToolKit_config.lua +++ b/Sys/Scripts/config/TASToolKit_config.lua @@ -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", @@ -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" }