-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add basic support for saving edits to the objects (#12)
* revert to old string table attribute since we need them in the struct definition to know which bytes to write 0 to in save() * fix object loading * get rudimentary saving working (vehicles don't load though...) * vehicles load now * fix scenariotext object loading * misc fixes * fix industryobject not loading * show user list of supported save objects * precommit for object control * undo object control * apply changes from code review, fix many compiler warnings
- Loading branch information
Showing
58 changed files
with
939 additions
and
744 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
using System.ComponentModel; | ||
using OpenLocoTool.Headers; | ||
|
||
namespace OpenLocoTool.DatFileParsing | ||
{ | ||
[TypeConverter(typeof(ExpandableObjectConverter))] | ||
public class G1Dat(G1Header g1Header, List<G1Element32> g1Elements) | ||
{ | ||
public G1Header G1Header { get; set; } = g1Header; | ||
public List<G1Element32> G1Elements { get; set; } = g1Elements; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
using System.ComponentModel; | ||
using OpenLocoTool.Headers; | ||
|
||
namespace OpenLocoTool.DatFileParsing | ||
{ | ||
[TypeConverter(typeof(ExpandableObjectConverter))] | ||
public interface ILocoObject | ||
{ | ||
S5Header S5Header { get; set; } | ||
ObjectHeader ObjectHeader { get; set; } | ||
ILocoStruct Object { get; set; } | ||
StringTable StringTable { get; set; } | ||
G1Header G1Header { get; set; } | ||
List<G1Element32> G1Elements { get; set; } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
using System.ComponentModel; | ||
|
||
namespace OpenLocoTool.DatFileParsing | ||
{ | ||
/* | ||
=== Dat File Format === | ||
|-File-------------------------------| | ||
|-S5Header-|-DatHeader--|-ObjectData-| | ||
============================================================================================================== | ||
|-S5Header----------------| | ||
|-Flags-|-Name-|-Checksum-| | ||
|-DatHeader-------------| | ||
|-Encoding-|-Datalength-| | ||
|-ObjectData-----------------------------------------| | ||
|-Object-|-StringTable-|-VariableData-|-GraphicsData-| | ||
============================================================================================================== | ||
|-Object-| | ||
-- per-object | ||
|-StringTable-| | ||
|-String{n}---| | ||
|-VariableData-| | ||
-- per-object | ||
|-GraphicsData------------------------------| | ||
|-G1Header-|-G1Element32{n}-|-ImageBytes{n}-| | ||
============================================================================================================== | ||
|-String-----------------| | ||
|-Language-|-StringBytes-| | ||
|-G1Header---------------| | ||
|-NumEntries-|-TotalSize-| | ||
|-G1Element32------------------------------------------------------| | ||
|-Offset-|-Width-|-Height-|-xOffset-|-yOffset-|-Flags-|-ZoomOffset-| | ||
|-ImageBytes-| | ||
-- offset by G1Element32.Offset | ||
*/ | ||
|
||
[TypeConverter(typeof(ExpandableObjectConverter))] | ||
public interface ILocoStruct | ||
{ | ||
static int StructSize { get; } | ||
} | ||
} |
10 changes: 10 additions & 0 deletions
10
OpenLocoTool/DatFileParsing/ILocoStructStringTablePostLoad.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
using System.ComponentModel; | ||
|
||
namespace OpenLocoTool.DatFileParsing | ||
{ | ||
[TypeConverter(typeof(ExpandableObjectConverter))] | ||
public interface ILocoStructStringTablePostLoad | ||
{ | ||
void LoadPostStringTable(StringTable stringTable); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
using System.ComponentModel; | ||
|
||
namespace OpenLocoTool.DatFileParsing | ||
{ | ||
[TypeConverter(typeof(ExpandableObjectConverter))] | ||
public interface ILocoStructVariableData | ||
{ | ||
ReadOnlySpan<byte> Load(ReadOnlySpan<byte> remainingData); | ||
|
||
ReadOnlySpan<byte> Save(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.