Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactoring, Bug fixes and a couple new features. #167

Merged
merged 67 commits into from
Mar 30, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
67 commits
Select commit Hold shift + click to select a range
305d9c8
change form of if.
Sebanisu Mar 5, 2020
df60783
Merge branch 'master' into Battle-Menu
Sebanisu Mar 5, 2020
cce9db7
i am refactoring the kernel.bin not done
Sebanisu Mar 6, 2020
877339d
unfinished changes but just wasted time moving them all between branches
Sebanisu Mar 9, 2020
add485f
Merge branch 'master' into Battle-Menu
Sebanisu Mar 9, 2020
b801008
fix the path was wrong for these two files.
Sebanisu Mar 9, 2020
ef74fd1
fix multiple merge conflicts. still more to do.
Sebanisu Mar 9, 2020
4dfe5c2
more fixes almost back to where I was ;-;
Sebanisu Mar 9, 2020
667f445
We have bugs but we are up and running again. I can fix bugs.
Sebanisu Mar 10, 2020
0e771b7
some more refactoring of kernel
Sebanisu Mar 10, 2020
2308393
most of the refactoring of kernel is done.
Sebanisu Mar 10, 2020
c2acd20
I tried to group some things up into folders
Sebanisu Mar 10, 2020
5c48b10
moved commands classes around
Sebanisu Mar 10, 2020
2a87a16
string dump app
Sebanisu Mar 10, 2020
4014c10
fix strings
Sebanisu Mar 10, 2020
e6ec6be
fix was getting null exception when running linux and opengl on windows.
Sebanisu Mar 10, 2020
608d6fd
new string dump app.
Sebanisu Mar 11, 2020
6a2deec
dumping the strings in another way thinking maybe it'll be easier to …
Sebanisu Mar 11, 2020
b8f61b4
minor refactoring to movies objects
Sebanisu Mar 12, 2020
30c5cb9
refactor some of FFCC with reshaper
Sebanisu Mar 12, 2020
f5da79c
some more refactoring to sound and sound entry.
Sebanisu Mar 12, 2020
d214ee5
wip changes
Sebanisu Mar 12, 2020
a0a49e9
wip battle.dat things compile again! woohooo.
Sebanisu Mar 12, 2020
af5feb0
wip battledat breakup
Sebanisu Mar 17, 2020
7a5c0e1
added some comments to Section2 objects.
Sebanisu Mar 17, 2020
ada71e4
refactor information put enums in own files.
Sebanisu Mar 17, 2020
7190a72
wip animationframe buggy right now.
Sebanisu Mar 17, 2020
442e6e7
woo it's running again lol bitreader has an offset value that needs t…
Sebanisu Mar 17, 2020
e4b1434
fixed a crash and overloaded ireadonlylist when there was one array i…
Sebanisu Mar 17, 2020
9070314
moved texture grabbing code to textures object.
Sebanisu Mar 17, 2020
b7c1259
sequences i think are okay. it's just a bunch of bytes right now as w…
Sebanisu Mar 17, 2020
3dd8371
refactoring the dat files is done for now.
Sebanisu Mar 18, 2020
5a3d26a
i moved all the dat file related objectsinto the dat folder. refactor…
Sebanisu Mar 18, 2020
bee5b1d
fix varible names. ran codemaid moved enum to own file.
Sebanisu Mar 18, 2020
2849dfb
refactor in field bg. and fix endless loop.
Sebanisu Mar 18, 2020
b0a9ddf
Update Module.cs
Sebanisu Mar 18, 2020
5398645
clean up code on Tiles and other field classes.
Sebanisu Mar 18, 2020
c278281
fix mass rename of ID to BattleID
Sebanisu Mar 19, 2020
2209f42
fix background rendering
Sebanisu Mar 19, 2020
b5bcf8e
fix reswizzle? need to test. heh
Sebanisu Mar 19, 2020
2e25aee
const z and wrapped some long lines removed extra ascending
Sebanisu Mar 19, 2020
e95cfe6
cleaned up camera class and cameras class
Sebanisu Mar 19, 2020
11e16e5
moved blacking out background to the module.
Sebanisu Mar 19, 2020
37f99c1
texIdbuffer to a ushort instead of byte.
Sebanisu Mar 19, 2020
de37cce
fixed ending
Sebanisu Mar 19, 2020
39d8f76
removed extra paratheis
Sebanisu Mar 19, 2020
1a60152
tweaks to stage classes changed values to readonly.
Sebanisu Mar 23, 2020
a11c9cb
tweakes to texture handler and such to support the battlefieldpack
Sebanisu Mar 23, 2020
1e55c5d
i switched my visual studio to use vars more. I also tweaked the skyd…
Sebanisu Mar 24, 2020
0323617
changed more things to var. added a SavePNG to tim. correctly loading…
Sebanisu Mar 24, 2020
62bc747
fix side menu so it reloads battle.
Sebanisu Mar 25, 2020
fb497c1
I have the remaster textures loading for the battle except some
Sebanisu Mar 25, 2020
225a7f1
fix weapons selection
Sebanisu Mar 25, 2020
9fff958
altered costumes code to be the same as weapons. also flipped the != …
Sebanisu Mar 25, 2020
3b2822a
fix rinoa and ward
Sebanisu Mar 25, 2020
0f5e0f3
Merge branch 'master' into Battle-Menu
Sebanisu Mar 26, 2020
f7c97d2
made fields readonly for texturetype and added private constructor
Sebanisu Mar 26, 2020
665c35a
mass change to var
Sebanisu Mar 26, 2020
7ca2f66
rain codemaid on sections of code changed UInt16 to short etc. added …
Sebanisu Mar 27, 2020
35206dd
Merge branch 'master' into Battle-Menu, theres gonna be bugs
Sebanisu Mar 28, 2020
df3b05a
Cleaned up memory class and I fixed the errors caused from merge.
Sebanisu Mar 29, 2020
991a207
fix atb timer always 0
Sebanisu Mar 29, 2020
8d920e0
fix issues in IGM and LGSG menus with laguna's team. and cleaned up s…
Sebanisu Mar 30, 2020
1d6c87b
fixed laguna in the battle and menus. cleaned some more files.
Sebanisu Mar 30, 2020
9644ecc
fix bugs in field script from sorted fields.
Sebanisu Mar 30, 2020
3d0f1c3
disabled dumping of data for battledat, removed some unused references.
Sebanisu Mar 30, 2020
cb44316
created editorconfig to export my settings
Sebanisu Mar 30, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
58 changes: 58 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@

[*.proto]
indent_style=tab
indent_size=tab
tab_width=4

[*.{asax,ascx,aspx,cs,cshtml,css,htm,html,js,jsx,master,razor,skin,ts,tsx,vb,xaml,xamlx,xoml}]
indent_style=space
indent_size=4
tab_width=4

[*.{appxmanifest,axml,build,config,csproj,dbml,discomap,dtd,json,jsproj,lsproj,njsproj,nuspec,proj,props,resjson,resw,resx,StyleCop,targets,tasks,vbproj,xml,xsd}]
indent_style=space
indent_size=2
tab_width=2

[*]

# Microsoft .NET properties
csharp_new_line_before_members_in_object_initializers=false
csharp_preferred_modifier_order=public, private, protected, internal, new, abstract, virtual, sealed, override, static, readonly, extern, unsafe, volatile, async:suggestion
csharp_style_var_elsewhere=true:suggestion
csharp_style_var_for_built_in_types=true:suggestion
csharp_style_var_when_type_is_apparent=true:suggestion
dotnet_naming_rule.local_functions_rule.severity=warning
dotnet_naming_rule.local_functions_rule.style=lower_camel_case_style
dotnet_naming_rule.local_functions_rule.symbols=local_functions_symbols
dotnet_naming_style.lower_camel_case_style.capitalization=camel_case
dotnet_naming_symbols.local_functions_symbols.applicable_accessibilities=*
dotnet_naming_symbols.local_functions_symbols.applicable_kinds=local_function
dotnet_style_parentheses_in_arithmetic_binary_operators=never_if_unnecessary:none
dotnet_style_parentheses_in_other_binary_operators=never_if_unnecessary:none
dotnet_style_parentheses_in_relational_binary_operators=never_if_unnecessary:none
dotnet_style_predefined_type_for_locals_parameters_members=true:suggestion
dotnet_style_predefined_type_for_member_access=true:suggestion
dotnet_style_qualification_for_event=false:suggestion
dotnet_style_qualification_for_field=false:suggestion
dotnet_style_qualification_for_method=false:suggestion
dotnet_style_qualification_for_property=false:suggestion
dotnet_style_require_accessibility_modifiers=for_non_interface_members:suggestion

# ReSharper properties
resharper_csharp_naming_rule.local_functions=aaBb, AaBb

# ReSharper inspection severities
resharper_arrange_redundant_parentheses_highlighting=hint
resharper_arrange_this_qualifier_highlighting=hint
resharper_arrange_type_member_modifiers_highlighting=hint
resharper_arrange_type_modifiers_highlighting=hint
resharper_built_in_type_reference_style_for_member_access_highlighting=hint
resharper_built_in_type_reference_style_highlighting=hint
resharper_check_namespace_highlighting=none
resharper_invalid_xml_doc_comment_highlighting=none
resharper_redundant_base_qualifier_highlighting=warning
resharper_suggest_var_or_type_built_in_types_highlighting=hint
resharper_suggest_var_or_type_elsewhere_highlighting=hint
resharper_suggest_var_or_type_simple_types_highlighting=hint
resharper_use_deconstruction_highlighting=none
19 changes: 12 additions & 7 deletions Core/AV/Audio.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,23 +9,28 @@ public class Audio : Ffcc
/// <summary>
/// Opens filename and init class.
/// </summary>
public static Audio Load(string filename, int loopstart = -1) =>
Load<Audio>(filename, AVMediaType.AVMEDIA_TYPE_AUDIO, FfccMode.STATE_MACH, loopstart);
public static Audio Load(string filename, int loopStart = -1) =>
Load<Audio>(filename, AVMediaType.AVMEDIA_TYPE_AUDIO, FfccMode.StateMach, loopStart);

/// <summary>
/// Opens filename and init class.
/// </summary>
/// <remarks>
/// Could be better, but theres alot of hoops to jump through.
/// Could be better, but there are many hoops to jump through.
/// </remarks>
/// <see cref="https://stackoverflow.com/questions/9604633/reading-a-file-located-in-memory-with-libavformat"/>
/// <seealso cref="http://www.ffmpeg.org/doxygen/trunk/doc_2examples_2avio_reading_8c-example.html"/>
/// <seealso cref="https://stackoverflow.com/questions/24758386/intptr-to-callback-function"/>
public static unsafe Audio Load(BufferData buffer_Data, byte[] headerData, int loopstart = -1, FfccMode ffccMode = FfccMode.PROCESS_ALL) =>
Load(&buffer_Data, headerData, loopstart, ffccMode);
///

public static unsafe Audio Load(BufferData* buffer_Data, byte[] headerData, int loopstart = -1, FfccMode ffccMode = FfccMode.PROCESS_ALL) =>
Load<Audio>(buffer_Data, headerData, loopstart = -1, ffccMode, AVMediaType.AVMEDIA_TYPE_AUDIO);
public static Audio Load(Sound.Entry entryData, int loopStart = -1, FfccMode ffccMode = FfccMode.ProcessAll) =>
Load(entryData, entryData.HeaderData, loopStart, ffccMode);

public static unsafe Audio Load(BufferData bufferData, byte[] headerData, int loopStart = -1, FfccMode ffccMode = FfccMode.ProcessAll) =>
Load<Audio>(&bufferData, headerData, loopStart, ffccMode, AVMediaType.AVMEDIA_TYPE_AUDIO);

public static unsafe Audio Load(BufferData* bufferData, byte[] headerData, int loopStart = -1, FfccMode ffccMode = FfccMode.ProcessAll) =>
Load<Audio>(bufferData, headerData, loopStart, ffccMode, AVMediaType.AVMEDIA_TYPE_AUDIO);

#endregion Methods
}
Expand Down
87 changes: 47 additions & 40 deletions Core/AV/BufferData.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using System;
using FFmpeg.AutoGen;
using System;
using System.IO;
using FFmpeg.AutoGen;

namespace OpenVIII.AV
{
Expand All @@ -9,45 +9,73 @@ namespace OpenVIII.AV
/// </summary>
public struct BufferData
{
#region Fields

private IntPtr _header;

private long _totalReadData;

#endregion Fields

#region Enums

public enum TargetFile
{
SoundDat,
OtherZzz
}

#region Fields
#endregion Enums

#region Properties

public static string DataFileName { get; set; }
public long DataSeekLoc { get; set; }
private long _totalReadData;
public long DataSize { get; set; }
public uint HeaderSize { get; set; }
private IntPtr _header;
public TargetFile Target { get; set; }

#endregion Fields

#region Properties

public static string DataFileName { get; private set; }

#endregion Properties

#region Methods

public unsafe int Read(byte* buf, int bufSize)
{
{
int ret;
if (HeaderSize >0 && (ret = ReadHeader(buf, bufSize)) != ffmpeg.AVERROR_EOF)
if (HeaderSize > 0 && (ret = ReadHeader(buf, bufSize)) != ffmpeg.AVERROR_EOF)
return ret;
return ReadData(buf, bufSize);
}

public unsafe void SetHeader(byte* value) => _header = (IntPtr)value;

internal long Seek(long offset, int whence)
{
switch (whence)
{
case ffmpeg.AVSEEK_SIZE:
return offset == 0
? _totalReadData
: throw new Exception($"unknown {nameof(whence)}: {whence}, {nameof(offset)}: {offset}");

case 0:
offset -= _totalReadData;
break;

default:
throw new Exception($"unknown {nameof(whence)}: {whence}");
}

DataSeekLoc += offset;
_totalReadData += offset;
DataSize -= offset;
return _totalReadData;
}

private unsafe int ReadData(byte* buf, int bufSize)
{
if (string.IsNullOrWhiteSpace(DataFileName))
DataFileName = Path.Combine(Memory.FF8DIRdata, "Sound", "audio.dat");
DataFileName = Path.Combine(Memory.FF8DirData, "Sound", "audio.dat");

bufSize = Math.Min(bufSize, (int)DataSize);

Expand All @@ -70,6 +98,7 @@ private unsafe int ReadData(byte* buf, int bufSize)
s = new MemoryStream(other.GetBinaryFile("audio.dat", true), false);
}
break;

case TargetFile.OtherZzz:
other = (ArchiveZzz)ArchiveZzz.Load(Memory.Archives.ZZZ_OTHER);
s = other.OpenStream();
Expand All @@ -81,11 +110,11 @@ private unsafe int ReadData(byte* buf, int bufSize)
}

// binaryReader disposes of fs
if(s == null) throw new NullReferenceException($"{nameof(BufferData)}::{nameof(ReadData)} stream is null");
using (BinaryReader br = new BinaryReader(s))
if (s == null) throw new NullReferenceException($"{nameof(BufferData)}::{nameof(ReadData)} stream is null");
using (var br = new BinaryReader(s))
{
s.Seek(DataSeekLoc, SeekOrigin.Begin);
using (UnmanagedMemoryStream ums = new UnmanagedMemoryStream(buf, bufSize, bufSize, FileAccess.Write))
using (var ums = new UnmanagedMemoryStream(buf, bufSize, bufSize, FileAccess.Write))
{
// copy public buffer data to buf
ums.Write(br.ReadBytes(bufSize), 0, bufSize);
Expand Down Expand Up @@ -115,28 +144,6 @@ private unsafe int ReadHeader(byte* buf, int bufSize)
return bufSize;
}

internal long Seek(long offset, int whence)
{
switch (whence)
{
case ffmpeg.AVSEEK_SIZE:
return offset == 0
? _totalReadData
: throw new Exception($"unknown {nameof(whence)}: {whence}, {nameof(offset)}: {offset}");

case 0:
offset -= _totalReadData;
break;
default:
throw new Exception($"unknown {nameof(whence)}: {whence}");
}

DataSeekLoc += offset;
_totalReadData += offset;
DataSize -= offset;
return _totalReadData;
}

#endregion Methods
}
}
Loading