Generator script - support quoted fields + require python3
MODIFY
generator/csv/constants.csv
generator/csv/constants.csv
-#Structure,name,type,value,comment
+Structure,name,type,value,comment
State,kDeathID,int,1,The ID of the special death state
SavePartyLocation,kPanXDefault,int,9 * 256,Equal to 9 tiles in 1/16th pixels
SavePartyLocation,kPanYDefault,int,7 * 256,Equal to 7 tiles in 1/16th pixels

MODIFY
generator/csv/enums.csv
generator/csv/enums.csv
-#Structure,Entry,Value,Index
+Structure,Entry,Value,Index
AnimationTiming,FlashScope,nothing,0
AnimationTiming,FlashScope,target,1
AnimationTiming,FlashScope,screen,2

MODIFY
generator/csv/enums_easyrpg.csv
generator/csv/enums_easyrpg.csv
-#Structure,Entry,Value,Index
+Structure,Entry,Value,Index
EventCommand,Code,Maniac_GetSaveInfo,3001
EventCommand,Code,Maniac_Save,3002
EventCommand,Code,Maniac_Load,3003

MODIFY
generator/csv/fields.csv
generator/csv/fields.csv
-#Structure,Field,Size Field?,Type,Index,Default Value,PersistIfDefault,Is2k3,Comment
+Structure,Field,Size Field?,Type,Index,Default Value,PersistIfDefault,Is2k3,Comment
Learning,level,f,Int32,0x01,1,0,0,Integer
Learning,skill_id,f,Ref<Skill>,0x02,1,0,0,Integer
Actor,name,f,DBString,0x01,'',0,0,String
@@ -34,7 +34,7 @@ Actor,state_ranks,f,Vector<UInt8>,0x48,,1,0,Array - Short
Actor,attribute_ranks,t,Vector<UInt8>,0x49,,0,0,Integer
Actor,attribute_ranks,f,Vector<UInt8>,0x4A,,1,0,Array - Short
Actor,battle_commands,f,Vector<Ref<BattleCommand:Int32>>,0x50,,1,1,Array - rpg::BattleCommand - RPG2003
-Sound,name,f,String,0x01,"(OFF)",1,0,String
+Sound,name,f,String,0x01,"""(OFF)""",1,0,String
Sound,volume,f,Int32,0x03,100,0,0,Integer
Sound,tempo,f,Int32,0x04,100,0,0,Integer
Sound,balance,f,Int32,0x05,50,0,0,Integer
@@ -504,7 +504,7 @@ Terms,file,f,DBString,0x94,'',1,0,String
Terms,exit_game_message,f,DBString,0x97,'',1,0,String
Terms,yes,f,DBString,0x98,'',1,0,String
Terms,no,f,DBString,0x99,'',1,0,String
-Music,name,f,String,0x01,"(OFF)",1,0,String
+Music,name,f,String,0x01,"""(OFF)""",1,0,String
Music,fadein,f,Int32,0x02,0,0,0,Integer
Music,volume,f,Int32,0x03,100,0,0,Integer
Music,tempo,f,Int32,0x04,100,0,0,Integer

MODIFY
generator/csv/fields_easyrpg.csv
generator/csv/fields_easyrpg.csv
-#Structure,Field,Size Field?,Type,Index,Default Value,PersistIfDefault,Is2k3,Comment
+Structure,Field,Size Field?,Type,Index,Default Value,PersistIfDefault,Is2k3,Comment
Save,easyrpg_data,f,SaveEasyRpgData,0xc8,,0,0,Additional save data written by EasyRPG Player
SaveEasyRpgData,version,,Int32,1,0,0,0,Savegame version

MODIFY
generator/csv/flags.csv
generator/csv/flags.csv
-#Structure,Field,Is2k3
+Structure,Field,Is2k3
TroopPageCondition,switch_a,0
TroopPageCondition,switch_b,0
TroopPageCondition,variable,0

MODIFY
generator/csv/setup.csv
generator/csv/setup.csv
-#Structure,Method,Headers
+Structure,Method,Headers
Actor,void Setup(),
Chipset,void Init(),
Save,void Setup(),
@@ -6,11 +6,11 @@ SaveActor,void Setup(int actor_id),
SaveActor,void Fixup(int actor_id),
SaveActor,void UnFixup(),
SaveInventory,void Setup(),
-SaveMapEvent,void Setup(const rpg::Event& event),"lcf/rpg/event.h"
+SaveMapEvent,void Setup(const rpg::Event& event),"""lcf/rpg/event.h"""
SaveMapInfo,void Setup(),
-SaveMapInfo,void Setup(const rpg::Map& map),"lcf/rpg/map.h"
+SaveMapInfo,void Setup(const rpg::Map& map),"""lcf/rpg/map.h"""
SaveMapInfo,void Fixup(const rpg::Map& map),
-SaveMapInfo,void Fixup(const rpg::MapInfo& map),"lcf/rpg/mapinfo.h"
+SaveMapInfo,void Fixup(const rpg::MapInfo& map),"""lcf/rpg/mapinfo.h"""
SaveMapInfo,void UnFixup(const rpg::Map& map),
SaveMapInfo,void UnFixup(const rpg::MapInfo& map),
SaveSystem,void Setup(),

MODIFY
generator/csv/structs.csv
generator/csv/structs.csv
-#Type,Structure,Base,Index available?
+Type,Structure,Base,Index available?
ldb,Parameters,,
ldb,Equipment,,
ldb,EventCommand,,

MODIFY
generator/csv/structs_easyrpg.csv
generator/csv/structs_easyrpg.csv
-#Type,Structure,Base,Index available?
+Type,Structure,Base,Index available?
lsd,SaveEasyRpgData,,0

MODIFY
generator/generate.py
generator/generate.py
-#!/usr/bin/env python
-
-from __future__ import division
+#!/usr/bin/env python3
+import pandas as pd
+import numpy as np
import sys
import os
import re
@@ -234,18 +234,13 @@ def merge_dicts(dicts):
def process_file(filename, namedtup):
# Mapping is: All elements of the line grouped by the first column
- result = OrderedDict()
+ path = os.path.join(csv_dir, filename)
+ df = pd.read_csv(path, comment='#', dtype=np.str)
+ df = df.fillna("")
- with open(os.path.join(csv_dir, filename), 'r') as f:
- lines = []
- for line in f:
- sline = line.strip()
- if not sline:
- continue
- if sline.startswith("#"):
- continue
- lines.append(sline.split(','))
+ lines = [ list(r) for _i, r in df.iterrows() ]
+ result = OrderedDict()
for k, g in groupby(lines, operator.itemgetter(0)):
result[k] = list(map(lambda x: namedtup(*x[1:]), list(g)))

Generator script - support quoted fields + require python3