mirror of
https://github.com/kwsch/NHSE.git
synced 2026-03-21 17:24:30 -05:00
Misc tweaks
No functional change
This commit is contained in:
parent
3d9d10bb97
commit
ff4c77a06c
|
|
@ -190,17 +190,9 @@ public void SetAcreBytes(ReadOnlySpan<byte> data)
|
|||
|
||||
public const int MapDesignNone = 0xF800;
|
||||
|
||||
public ushort[] GetMapDesignTiles()
|
||||
{
|
||||
var slice = Data.Slice(Offsets.MyDesignMap, 112 * 96 * sizeof(ushort));
|
||||
return MemoryMarshal.Cast<byte, ushort>(slice).ToArray();
|
||||
}
|
||||
|
||||
public void SetMapDesignTiles(ReadOnlySpan<ushort> value)
|
||||
{
|
||||
var cast = MemoryMarshal.Cast<ushort, byte>(value);
|
||||
cast.CopyTo(Data[Offsets.MyDesignMap..]);
|
||||
}
|
||||
public Memory<byte> MapDesignTileData => Raw.Slice(Offsets.MyDesignMap, 112 * 96 * sizeof(ushort));
|
||||
public ushort[] GetMapDesignTiles() => MemoryMarshal.Cast<byte, ushort>(MapDesignTileData.Span).ToArray();
|
||||
public void SetMapDesignTiles(ReadOnlySpan<ushort> value) => MemoryMarshal.Cast<ushort, byte>(value).CopyTo(MapDesignTileData.Span);
|
||||
|
||||
private const int FieldItemLayerSize = MapGrid.MapTileCount32x32 * Item.SIZE;
|
||||
private const int FieldItemFlagSize = MapGrid.MapTileCount32x32 / 8; // bitflags
|
||||
|
|
|
|||
|
|
@ -5,89 +5,89 @@
|
|||
/// </summary>
|
||||
public enum Reaction : byte
|
||||
{
|
||||
None,
|
||||
Happiness, // Smiling
|
||||
Laughter, // Laughing
|
||||
Joy, // HappyFlower
|
||||
Love, // Love
|
||||
Glee, // HappyDance
|
||||
UNUSED_6, // Anger (Unused)
|
||||
Aggravation, // Outraged
|
||||
UNUSED_8, // Outrage (Unused)
|
||||
Worry, // Worried
|
||||
Sighing, // Sighing
|
||||
Thought, // Thinking
|
||||
Sadness, // SadSpiral
|
||||
Distress, // Frantic
|
||||
Sorrow, // Crying
|
||||
Amazed, // Shocked
|
||||
Surprise, // Aha
|
||||
UNUSED_17, // Disbelief (Unused)
|
||||
Shocked, // Surprised
|
||||
Cold_Chill, // ColdChill
|
||||
Fearful, // Shaking
|
||||
Agreement, // Nodding
|
||||
Inspiration, // IdeaBulb
|
||||
Curiosity, // QuestionMark
|
||||
Heartbreak, // BrokenHeart
|
||||
Sleepy, // Sleepy
|
||||
Bashfulness, // Blushing
|
||||
Resignation, // OhGeez
|
||||
Mischief, // Scheming
|
||||
Delight, // Clapping
|
||||
Sneezing, // Sneezing
|
||||
Encouraging, // Cheering
|
||||
Greetings, // Greeting
|
||||
Pride, // SmugFace
|
||||
UNUSED_34, // Sweating (Unused)
|
||||
Smirking, // Grin
|
||||
Sheepishness, // WrySmile
|
||||
UNUSED_37, // Smile (Unused)
|
||||
UNUSED_38, // Sunniness (Unused)
|
||||
Shyness, // Hesitate
|
||||
Disagreement, // Negative
|
||||
Mistaken, // Oops
|
||||
Flourish, // Dance
|
||||
Daydreaming, // AbsentMindedness
|
||||
Showmanship, // Shaki
|
||||
Dozing, // Sleep
|
||||
UNUSED_46, // Shrunk Funk Shuffle (Unused)
|
||||
Intense, // Silent
|
||||
Pleased, // Hello
|
||||
UNUSED_49, // Distress without the hand movements? (Unused)
|
||||
UNUSED_50, // Smiling and rubbing cheek (Unused)
|
||||
UNUSED_51, // Poking hands together (Unused)
|
||||
UNUSED_52, // Intense but frowning (Unused)
|
||||
UNUSED_53, // Amazed with smaller particles (Unused)
|
||||
Apologetic, // Apologize
|
||||
Confident, // Assent
|
||||
UNUSED_56, // Talking (Unused)
|
||||
UNUSED_57, // Clapping with no expression (Makes you stand up if sitting down) (Unused)
|
||||
Bewilderment, // Pardon
|
||||
UNUSED_59, // Greetings with no sound or expression (Unused)
|
||||
None = 0,
|
||||
Happiness = 1, // Smiling
|
||||
Laughter = 2, // Laughing
|
||||
Joy = 3, // HappyFlower
|
||||
Love = 4, // Love
|
||||
Glee = 5, // HappyDance
|
||||
UNUSED_6 = 6, // Anger (Unused)
|
||||
Aggravation = 7, // Outraged
|
||||
UNUSED_8 = 8, // Outrage (Unused)
|
||||
Worry = 9, // Worried
|
||||
Sighing = 10, // Sighing
|
||||
Thought = 11, // Thinking
|
||||
Sadness = 12, // SadSpiral
|
||||
Distress = 13, // Frantic
|
||||
Sorrow = 14, // Crying
|
||||
Amazed = 15, // Shocked
|
||||
Surprise = 16, // Aha
|
||||
UNUSED_17 = 17, // Disbelief (Unused)
|
||||
Shocked = 18, // Surprised
|
||||
Cold_Chill = 19, // ColdChill
|
||||
Fearful = 20, // Shaking
|
||||
Agreement = 21, // Nodding
|
||||
Inspiration = 22, // IdeaBulb
|
||||
Curiosity = 23, // QuestionMark
|
||||
Heartbreak = 24, // BrokenHeart
|
||||
Sleepy = 25, // Sleepy
|
||||
Bashfulness = 26, // Blushing
|
||||
Resignation = 27, // OhGeez
|
||||
Mischief = 28, // Scheming
|
||||
Delight = 29, // Clapping
|
||||
Sneezing = 30, // Sneezing
|
||||
Encouraging = 31, // Cheering
|
||||
Greetings = 32, // Greeting
|
||||
Pride = 33, // SmugFace
|
||||
UNUSED_34 = 34, // Sweating (Unused)
|
||||
Smirking = 35, // Grin
|
||||
Sheepishness = 36, // WrySmile
|
||||
UNUSED_37 = 37, // Smile (Unused)
|
||||
UNUSED_38 = 38, // Sunniness (Unused)
|
||||
Shyness = 39, // Hesitate
|
||||
Disagreement = 40, // Negative
|
||||
Mistaken = 41, // Oops
|
||||
Flourish = 42, // Dance
|
||||
Daydreaming = 43, // AbsentMindedness
|
||||
Showmanship = 44, // Shaki
|
||||
Dozing = 45, // Sleep
|
||||
UNUSED_46 = 46, // Shrunk Funk Shuffle (Unused)
|
||||
Intense = 47, // Silent
|
||||
Pleased = 48, // Hello
|
||||
UNUSED_49 = 49, // Distress without the hand movements? (Unused)
|
||||
UNUSED_50 = 50, // Smiling and rubbing cheek (Unused)
|
||||
UNUSED_51 = 51, // Poking hands together (Unused)
|
||||
UNUSED_52 = 52, // Intense but frowning (Unused)
|
||||
UNUSED_53 = 53, // Amazed with smaller particles (Unused)
|
||||
Apologetic = 54, // Apologize
|
||||
Confident = 55, // Assent
|
||||
UNUSED_56 = 56, // Talking (Unused)
|
||||
UNUSED_57 = 57, // Clapping with no expression (Makes you stand up if sitting down) (Unused)
|
||||
Bewilderment = 58, // Pardon
|
||||
UNUSED_59 = 59, // Greetings with no sound or expression (Unused)
|
||||
|
||||
Scare, // AddPrank
|
||||
Haunt, // AddScaring
|
||||
SitDown, // AddSitDown
|
||||
Yoga, // AddYoga
|
||||
HereYouGo, // AddHereYouGo
|
||||
WorkOut, // AddGymnastics
|
||||
TakeAPicture, // AddTakePictures
|
||||
SniffSniff, // AddSmell
|
||||
Tada, // AddPraise
|
||||
WaveGoodbye, // AddWaveHands
|
||||
Excited, // AddExcited
|
||||
Scare = 60, // AddPrank
|
||||
Haunt = 61, // AddScaring
|
||||
SitDown = 62, // AddSitDown
|
||||
Yoga = 63, // AddYoga
|
||||
HereYouGo = 64, // AddHereYouGo
|
||||
WorkOut = 65, // AddGymnastics
|
||||
TakeAPicture = 66, // AddTakePictures
|
||||
SniffSniff = 67, // AddSmell
|
||||
Tada = 68, // AddPraise
|
||||
WaveGoodbye = 69, // AddWaveHands
|
||||
Excited = 70, // AddExcited
|
||||
|
||||
Confetti, // (Festivale DLC)
|
||||
Viva, // (Festivale DLC)
|
||||
LetsGo, // (Festivale DLC)
|
||||
FeelinIt, // (Festivale DLC)
|
||||
Confetti = 71, // (Festivale DLC)
|
||||
Viva = 72, // (Festivale DLC)
|
||||
LetsGo = 73, // (Festivale DLC)
|
||||
FeelinIt = 74, // (Festivale DLC)
|
||||
|
||||
UNUSED_75, // Gullivar about to come alive (Unused)
|
||||
UNUSED_76, // Intense shake action (Unused)
|
||||
UNUSED_77, // Literally the "roll safe" meme (google it) (Unused)
|
||||
UNUSED_78, // Leave it to me! (Unused)
|
||||
UNUSED_79, // K.K. Slider Sitting (Unused)
|
||||
UNUSED_80, // K.K. nodding while sitting (Unused)
|
||||
UNUSED_81, // K.K. thinking while sitting (Unused)
|
||||
UNUSED_75 = 75, // Gullivar about to come alive (Unused)
|
||||
UNUSED_76 = 76, // Intense shake action (Unused)
|
||||
UNUSED_77 = 77, // Literally the "roll safe" meme (google it) (Unused)
|
||||
UNUSED_78 = 78, // Leave it to me! (Unused)
|
||||
UNUSED_79 = 79, // K.K. Slider Sitting (Unused)
|
||||
UNUSED_80 = 80, // K.K. nodding while sitting (Unused)
|
||||
UNUSED_81 = 81, // K.K. thinking while sitting (Unused)
|
||||
}
|
||||
|
|
@ -7,6 +7,33 @@ namespace NHSE.Parsing;
|
|||
|
||||
public static class GameMSBTDumper
|
||||
{
|
||||
/// <summary>
|
||||
/// Dumps everything the program uses to the provided <see cref="dest"/>, using the provided <see cref="root"/>.
|
||||
/// </summary>
|
||||
/// <param name="root">Source of <see cref="MSBT"/> files.</param>
|
||||
/// <param name="dest">Destination folder where the dumps will be saved.</param>
|
||||
/// <param name="csv">Convert all <see cref="MSBT"/> files to CSV for easy viewing.</param>
|
||||
/// <param name="delim">Delimiter when exporting the <see cref="csv"/> files</param>
|
||||
public static void UpdateDumps(string root, string dest, bool csv = true, char delim = '\t')
|
||||
{
|
||||
if (csv)
|
||||
UpdateCSV(root, Path.Combine(dest, "csv"), delim);
|
||||
}
|
||||
|
||||
public static void UpdateCSV(string root, string dest, char delim = '\t')
|
||||
{
|
||||
Directory.CreateDirectory(dest);
|
||||
var files = Directory.GetFiles(root, "*.msbt", SearchOption.AllDirectories);
|
||||
foreach (var file in files)
|
||||
{
|
||||
var relative = Path.GetRelativePath(root, file);
|
||||
var outPath = Path.Combine(dest, relative + ".csv");
|
||||
Directory.CreateDirectory(Path.GetDirectoryName(outPath)!);
|
||||
var csvData = MSBTUtil.GetCSV(file, delim);
|
||||
File.WriteAllLines(outPath, csvData);
|
||||
}
|
||||
}
|
||||
|
||||
public static string[] GetItemListResource(string msgPath, string language)
|
||||
{
|
||||
var list = GetItemList(msgPath, language);
|
||||
|
|
|
|||
|
|
@ -16,6 +16,31 @@ public static void DebugDumpLines(this MSBT obj)
|
|||
|
||||
public static IEnumerable<string> GetOrderedLines(string path, int indexBias = 0) => new MSBT(File.ReadAllBytes(path)).GetOrderedLines(indexBias);
|
||||
|
||||
public static IEnumerable<string> GetCSV(string path, int indexBias = 0, char delim = '\t')
|
||||
{
|
||||
var obj = new MSBT(File.ReadAllBytes(path));
|
||||
var sorted = obj.LBL1.Labels
|
||||
.Where(z => !z.Name.EndsWith("_pl"))
|
||||
.OrderBy(z => z.Index);
|
||||
foreach (var x in sorted)
|
||||
{
|
||||
var index = x.Index;
|
||||
var name = x.Name;
|
||||
var strings = obj.TXT2.Strings;
|
||||
var line = GetStringIndex(index, strings, obj);
|
||||
yield return $"{index + indexBias}{delim}\"{name}\"{delim}\"{line.Replace("\"", "\"\"")}\"";
|
||||
}
|
||||
}
|
||||
|
||||
private static string GetStringIndex(uint index, List<MSBTTextString> strings, MSBT obj)
|
||||
{
|
||||
if (index >= strings.Count)
|
||||
return $"INVALID INDEX?? {index}";
|
||||
var data = strings[(int)index];
|
||||
var line = data.ToString(obj.FileEncoding).TrimEnd('\0');
|
||||
return line;
|
||||
}
|
||||
|
||||
public static IEnumerable<string> GetOrderedLines(this MSBT obj, int indexBias = 0)
|
||||
{
|
||||
var sorted = obj.LBL1.Labels
|
||||
|
|
|
|||
|
|
@ -29,5 +29,7 @@ public static void DumpMSBT()
|
|||
Assert.SkipUnless(Directory.Exists(dump), "Dump not found, skip."); // skip this test if not properly configured for this test
|
||||
|
||||
GameMSBTDumperNHSE.Dump(folder, dump, MessageDumpFormat);
|
||||
|
||||
GameMSBTDumper.UpdateDumps(dump, dump);
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user