Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/scemino/nscumm.git
Browse files Browse the repository at this point in the history
  • Loading branch information
scemino committed May 7, 2016
2 parents 05a4a72 + f7eca5e commit 173904d
Show file tree
Hide file tree
Showing 28 changed files with 181 additions and 183 deletions.
2 changes: 1 addition & 1 deletion Engines/NScumm.Scumm/Actor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ internal string DebuggerDisplay
{
get
{
return string.Format("Name: {0}, IsInCurrentRoom: {1}, Visible: {2}", Name != null ? System.Text.Encoding.UTF8.GetString(Name) : null, IsInCurrentRoom, IsVisible);
return string.Format("Name: {0}, IsInCurrentRoom: {1}, Visible: {2}", Name != null ? Name.GetText() : null, IsInCurrentRoom, IsVisible);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ public int MatchFile(string filename)

if (tag == "LB23")
{
_budleDirCache[freeSlot].BundleTable[i].Filename = Encoding.UTF8.GetString(file.ReadBytes(24));
_budleDirCache[freeSlot].BundleTable[i].Filename = file.ReadBytes(24).GetText();
}
else
{
Expand All @@ -96,7 +96,7 @@ public int MatchFile(string filename)
if ((c = file.ReadByte()) != 0)
name.Add(c);

_budleDirCache[freeSlot].BundleTable[i].Filename = Encoding.UTF8.GetString(name.ToArray());
_budleDirCache[freeSlot].BundleTable[i].Filename = name.ToArray().GetText();
}
_budleDirCache[freeSlot].BundleTable[i].Offset = (int)file.ReadUInt32BigEndian();
_budleDirCache[freeSlot].BundleTable[i].Size = (int)file.ReadUInt32BigEndian();
Expand Down
2 changes: 1 addition & 1 deletion Engines/NScumm.Scumm/IO/MacResManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,7 @@ void ReadMap()
_stream.Seek(_resLists[i][j].nameOffset + _mapOffset + _resMap.nameOffset, SeekOrigin.Begin);

byte len = br.ReadByte();
_resLists[i][j].name = System.Text.Encoding.UTF8.GetString(br.ReadBytes(len));
_resLists[i][j].name = br.ReadBytes(len).GetText();
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion Engines/NScumm.Scumm/IO/ResourceFile8.cs
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@ protected override ObjectData ReadImageHeader()
{
// image header
var name = _reader.ReadBytes(40);
var text = ResourceIndex8.DataToString(name);
var text = name.GetText();
var id = ResourceIndex.ObjectIDMap[text];
var od = new ObjectData((ushort)id);

Expand Down
2 changes: 1 addition & 1 deletion Engines/NScumm.Scumm/IO/ResourceIndex7.cs
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ protected override void LoadIndex(GameInfo game)
AudioNames = new string[num];
for (int i = 0; i < num; i++)
{
AudioNames[i] = System.Text.Encoding.UTF8.GetString(br.ReadBytes(9));
AudioNames[i] = br.ReadBytes(9).GetText();
}
}
break;
Expand Down
16 changes: 2 additions & 14 deletions Engines/NScumm.Scumm/IO/ResourceIndex8.cs
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ protected override void LoadIndex(GameInfo game)
AudioNames = new string[num];
for (int i = 0; i < num; i++)
{
AudioNames[i] = System.Text.Encoding.UTF8.GetString(br.ReadBytes(9));
AudioNames[i] = br.ReadBytes(9).GetText();
}
}
break;
Expand Down Expand Up @@ -157,7 +157,7 @@ protected override void ReadDirectoryOfObjects(BinaryReader br)
for (var i = 0; i < num; i++)
{
// Add to object name-to-id map
var name = DataToString(br.ReadBytes(40));
var name = br.ReadBytes(40).GetText();
ObjectIDMap[name] = i;

ObjectStateTable[i] = br.ReadByte();
Expand All @@ -167,18 +167,6 @@ protected override void ReadDirectoryOfObjects(BinaryReader br)
}
}

public static string DataToString(byte[] data)
{
var sb = new List<byte>();
int i = 0;
while (i < data.Length && data[i] != 0)
{
sb.Add(data[i]);
i++;
}
return System.Text.Encoding.UTF8.GetString(sb.ToArray());
}

protected override Resource[] ReadResTypeList(BinaryReader br)
{
var numEntries = br.ReadInt32();
Expand Down
7 changes: 4 additions & 3 deletions Engines/NScumm.Scumm/NScumm.Scumm.csproj
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<MinimumVisualStudioVersion>10.0</MinimumVisualStudioVersion>
Expand All @@ -20,7 +20,7 @@
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>..\NScumm.MonoGame\Platforms\WindowsGL\bin\Debug\plugins\</OutputPath>
<OutputPath>..\..\NScumm.MonoGame\Platforms\WindowsGL\bin\Debug\plugins\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
Expand All @@ -41,6 +41,7 @@
<PlatformTarget>AnyCPU</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<!-- A reference to the entire .NET Framework is automatically included -->
Expand Down Expand Up @@ -306,7 +307,7 @@
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\NScumm.Core\NScumm.Core.csproj">
<Project>{8e7a9e5b-d7eb-4da1-8ee7-a5d8de202372}</Project>
<Project>{8E7A9E5B-D7EB-4DA1-8EE7-A5D8DE202372}</Project>
<Name>NScumm.Core</Name>
<Private>False</Private>
</ProjectReference>
Expand Down
2 changes: 1 addition & 1 deletion Engines/NScumm.Scumm/ObjectData.cs
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ internal string DebuggerDisplay
{
get
{
return Number != 0 ? string.Format("(Number: {0}, Name = {1})", Number, System.Text.Encoding.UTF8.GetString(Name)) : "Number 0";
return Number != 0 ? string.Format("(Number: {0}, Name = {1})", Number, Name.GetText()) : "Number 0";
}
}
}
Expand Down
6 changes: 3 additions & 3 deletions Engines/NScumm.Scumm/ScummEngine0.cs
Original file line number Diff line number Diff line change
Expand Up @@ -883,7 +883,7 @@ void DrawSentenceObject(int obj)
if (temp != null)
{
_sentenceBuf += " ";
_sentenceBuf += System.Text.Encoding.UTF8.GetString(temp);
_sentenceBuf += temp.GetText();
}
}

Expand Down Expand Up @@ -911,7 +911,7 @@ void DrawSentenceLine()
else
{
var a = Actors[actorId];
actorName = System.Text.Encoding.UTF8.GetString(a.Name);
actorName = a.Name.GetText();
}
_sentenceBuf += string.Format("{0,-13}", actorName);
}
Expand All @@ -924,7 +924,7 @@ void DrawSentenceLine()
_activeVerb = VerbsV0.WalkTo;

var verbName = Verbs[(int)_activeVerb].Text;
_sentenceBuf = System.Text.Encoding.UTF8.GetString(verbName);
_sentenceBuf = verbName.GetText();

if (_activeObject != 0)
{
Expand Down
8 changes: 4 additions & 4 deletions Engines/NScumm.Scumm/ScummEngine2.cs
Original file line number Diff line number Diff line change
Expand Up @@ -988,7 +988,7 @@ protected void SaveLoadGame()
{
// use name entered by the user
var firstSlot = StringIdSavename1;
name = Encoding.UTF8.GetString(_strings[slot + firstSlot - 1]);
name = _strings[slot + firstSlot - 1].GetText();
}

if (SavePreparedSavegame(slot, name))
Expand Down Expand Up @@ -2477,7 +2477,7 @@ void DrawSentence()
return;

if (Verbs[slot] != null && Verbs[slot].Text != null)
_sentenceBuf = Encoding.UTF8.GetString(Verbs[slot].Text);
_sentenceBuf = Verbs[slot].Text.GetText();
else
return;

Expand All @@ -2487,7 +2487,7 @@ void DrawSentence()
if (temp != null)
{
_sentenceBuf += " ";
_sentenceBuf += Encoding.UTF8.GetString(temp);
_sentenceBuf += temp.GetText();
}

// For V1 games, the engine must compute the preposition.
Expand Down Expand Up @@ -2515,7 +2515,7 @@ void DrawSentence()
if (temp != null)
{
_sentenceBuf += " ";
_sentenceBuf += Encoding.UTF8.GetString(temp);
_sentenceBuf += temp.GetText();
}
}

Expand Down
4 changes: 2 additions & 2 deletions Engines/NScumm.Scumm/ScummEngine7_Misc.cs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ protected override void KernelSetFunctions()
// SMUSH movie playback
if (args[1] == 0 && !_skipVideo)
{
var videoname = System.Text.Encoding.UTF8.GetString(GetStringAddressVar(VariableVideoName));
var videoname = GetStringAddressVar (VariableVideoName).GetText ();
// TODO: vs
// Correct incorrect smush filename in Macintosh FT demo
// if ((_game.id == GID_FT) && (_game.features & GF_DEMO) && (_game.platform == Common::kPlatformMacintosh) &&
Expand Down Expand Up @@ -880,7 +880,7 @@ void PlaySpeech(byte[] ptr)
var count = Array.IndexOf(ptr, (byte)0);
if (count < 0)
count = ptr.Length - 1;
var pointer = System.Text.Encoding.UTF8.GetString(ptr, 0, count);
var pointer = ptr.GetText(0, count);

// Play speech
if (!Game.Features.HasFlag(GameFeatures.Demo) && Game.GameId == GameId.CurseOfMonkeyIsland) // CMI demo does not have .IMX for voice
Expand Down
2 changes: 1 addition & 1 deletion Engines/NScumm.Scumm/ScummEngine_SaveLoad.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1463,7 +1463,7 @@ static SaveGameHeader LoadSaveGameHeader(BinaryReader reader)
throw new NotSupportedException("Invalid version");
}

hdr.Name = Encoding.UTF8.GetString(reader.ReadBytes(32));
hdr.Name = reader.ReadBytes(32).GetText();

// Since version 52 a thumbnail is saved directly after the header.
if (hdr.Version >= 52)
Expand Down
2 changes: 1 addition & 1 deletion Engines/NScumm.Scumm/ScummEngine_String.cs
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ void DebugMessage(byte[] msg)

if ((buffer[0] != 0xFF))
{
Debug.WriteLine("DEBUG: {0}", Encoding.UTF8.GetString(buffer));
Debug.WriteLine("DEBUG: {0}", buffer.GetText());
return;
}

Expand Down
5 changes: 3 additions & 2 deletions Engines/NScumm.Sky/NScumm.Sky.csproj
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<MinimumVisualStudioVersion>10.0</MinimumVisualStudioVersion>
Expand Down Expand Up @@ -41,11 +41,12 @@
<PlatformTarget>AnyCPU</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<!-- A reference to the entire .NET Framework is automatically included -->
<ProjectReference Include="..\..\NScumm.Core\NScumm.Core.csproj">
<Project>{8e7a9e5b-d7eb-4da1-8ee7-a5d8de202372}</Project>
<Project>{8E7A9E5B-D7EB-4DA1-8EE7-A5D8DE202372}</Project>
<Name>NScumm.Core</Name>
<Private>False</Private>
</ProjectReference>
Expand Down
4 changes: 2 additions & 2 deletions Engines/NScumm.Sword1/NScumm.Sword1.csproj
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<MinimumVisualStudioVersion>10.0</MinimumVisualStudioVersion>
Expand Down Expand Up @@ -36,7 +36,7 @@
<ItemGroup>
<!-- A reference to the entire .NET Framework is automatically included -->
<ProjectReference Include="..\..\NScumm.Core\NScumm.Core.csproj">
<Project>{8e7a9e5b-d7eb-4da1-8ee7-a5d8de202372}</Project>
<Project>{8E7A9E5B-D7EB-4DA1-8EE7-A5D8DE202372}</Project>
<Name>NScumm.Core</Name>
</ProjectReference>
</ItemGroup>
Expand Down
10 changes: 6 additions & 4 deletions NScumm-Linux.sln
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 14
# Visual Studio 2012
VisualStudioVersion = 14.0.24720.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NScumm.Core", "NScumm.Core\NScumm.Core.csproj", "{8E7A9E5B-D7EB-4DA1-8EE7-A5D8DE202372}"
Expand Down Expand Up @@ -37,6 +37,7 @@ Global
{8E7A9E5B-D7EB-4DA1-8EE7-A5D8DE202372}.Release|x86.ActiveCfg = Release|Any CPU
{8E7A9E5B-D7EB-4DA1-8EE7-A5D8DE202372}.Release|x86.Build.0 = Release|Any CPU
{B1F1416B-C52A-4CE5-AF06-C960F5165784}.Debug|Any CPU.ActiveCfg = Debug|x86
{B1F1416B-C52A-4CE5-AF06-C960F5165784}.Debug|Any CPU.Build.0 = Debug|x86
{B1F1416B-C52A-4CE5-AF06-C960F5165784}.Debug|Mixed Platforms.ActiveCfg = Debug|x86
{B1F1416B-C52A-4CE5-AF06-C960F5165784}.Debug|Mixed Platforms.Build.0 = Debug|x86
{B1F1416B-C52A-4CE5-AF06-C960F5165784}.Debug|x86.ActiveCfg = Debug|x86
Expand All @@ -59,11 +60,9 @@ Global
{D42434C7-459D-461A-8B1D-1451F7FF4B13}.Release|x86.ActiveCfg = Release|Any CPU
{D42434C7-459D-461A-8B1D-1451F7FF4B13}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
GlobalSection(NestedProjects) = preSolution
EndGlobalSection
GlobalSection(MonoDevelopProperties) = preSolution
BaseDirectory = .
Policies = $0
$0.DotNetNamingPolicy = $1
$1.DirectoryNamespaceAssociation = None
Expand All @@ -80,4 +79,7 @@ Global
$5.IncludeInstanceMembers = True
$5.IncludeStaticEntities = True
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal
Loading

0 comments on commit 173904d

Please sign in to comment.