Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
  •  
  •  
  •  
33 changes: 32 additions & 1 deletion src/BizHawk.Client.Common/DisplayManager/DisplayManagerBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,10 @@ protected DisplayManagerBase(
IMovieSession movieSession,
EDispMethod dispMethod,
IGL gl,
IGuiRenderer renderer)
IGuiRenderer renderer,
string usedPixelFontPathAndFirstName = null) // to load localization font 试图在这里传入字体信息
{
_customizedFontPathAndFirstName = usedPixelFontPathAndFirstName;
GlobalConfig = config;
GlobalEmulator = emulator;
SnowyVP = new()
Expand Down Expand Up @@ -165,6 +167,7 @@ public void Dispose()
// rendering resources:
protected readonly IGL _gl;

private string _customizedFontPathAndFirstName = null;
private StringRenderer _theOneFont;
private StringRenderer Font
{
Expand All @@ -181,6 +184,34 @@ private StringRenderer Font

if (_theOneFont?.LineHeight != fontSize)
{
// 如果定义了字体,优先加载定制的字体。 If customized font is defined, the customized font will be loaded first.
if (!string.IsNullOrEmpty(_customizedFontPathAndFirstName))
{
using var fontInfoData = ReflectionCache.EmbeddedResourceStream($"Resources.{_customizedFontPathAndFirstName}{fontSize}px.fnt");
List<Stream> texturesData = new List<Stream>();
int index = 0;
while (true)
{
// Load textures resources: 加载纹理资源: Resources.fontname16px_0.png,_1.png ...
using var theTextureData = ReflectionCache.EmbeddedResourceStream($"Resources.{_customizedFontPathAndFirstName}{fontSize}px_{index}.png");
if (theTextureData == null)
{
//theTextureData [i] 为空表示最后一张纹理已加载。
//theTextureData [i] is null indicates that last texture have been loaded.
break;
}
texturesData.Add(theTextureData);
index += 1;
}
// 至少要有一张贴图才算有效字体
// At least one map is required to be a valid font.
if (texturesData.Count > 0)
{
_theOneFont = new(_gl, fontInfoData, texturesData.ToArray());
return _theOneFont;
}
}
// The old font loader can only load one font. 旧的字体加载逻辑,只能加载固定字体。
using var fontInfo = ReflectionCache.EmbeddedResourceStream($"Resources.courier{fontSize}px.fnt");
using var tex = ReflectionCache.EmbeddedResourceStream($"Resources.courier{fontSize}px_0.png");
_theOneFont = new(_gl, fontInfo, tex);
Expand Down
94 changes: 41 additions & 53 deletions src/BizHawk.Client.DiscoHawk/About.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

108 changes: 100 additions & 8 deletions src/BizHawk.Client.DiscoHawk/About.resx
Original file line number Diff line number Diff line change
Expand Up @@ -117,15 +117,107 @@
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="lblVersion.Text" xml:space="preserve">
<value>version number</value>
</data>
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<data name="$this.ClientSize" type="System.Drawing.Size, System.Drawing">
<value>525, 260</value>
</data>
<assembly alias="mscorlib" name="mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<data name="lblVersion.TabIndex" type="System.Int32, mscorlib">
<value>3</value>
</data>
<data name="&gt;&gt;button1.ZOrder" xml:space="preserve">
<value>1</value>
</data>
<data name="&gt;&gt;$this.Type" xml:space="preserve">
<value>System.Windows.Forms.Form, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;richTextBox1.ZOrder" xml:space="preserve">
<value>2</value>
</data>
<data name="richTextBox1.TabIndex" type="System.Int32, mscorlib">
<value>1</value>
</data>
<data name="lblVersion.Location" type="System.Drawing.Point, System.Drawing">
<value>12, 239</value>
</data>
<data name="&gt;&gt;lblVersion.Parent" xml:space="preserve">
<value>$this</value>
</data>
<data name="$this.Text" xml:space="preserve">
<value>About DiscoHawk</value>
</data>
<data name="&gt;&gt;$this.Name" xml:space="preserve">
<value>About</value>
</data>
<data name="&gt;&gt;richTextBox1.Name" xml:space="preserve">
<value>richTextBox1</value>
</data>
<data name="button1.Size" type="System.Drawing.Size, System.Drawing">
<value>75, 21</value>
</data>
<data name="lblVersion.Size" type="System.Drawing.Size, System.Drawing">
<value>89, 12</value>
</data>
<data name="&gt;&gt;lblVersion.Name" xml:space="preserve">
<value>lblVersion</value>
</data>
<data name="&gt;&gt;button1.Type" xml:space="preserve">
<value>System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="$this.AutoScaleDimensions" type="System.Drawing.SizeF, System.Drawing">
<value>6, 12</value>
</data>
<data name="richTextBox1.Size" type="System.Drawing.Size, System.Drawing">
<value>499, 218</value>
</data>
<data name="button1.TabIndex" type="System.Int32, mscorlib">
<value>2</value>
</data>
<data name="lblVersion.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
</data>
<data name="richTextBox1.Location" type="System.Drawing.Point, System.Drawing">
<value>12, 11</value>
</data>
<data name="richTextBox1.Text" xml:space="preserve">
<value>DiscoHawk converts bolloxed-up crusty disc images to totally tidy CCD.
DiscoHawk is part of the BizHawk project ( https://github.com/TASEmulators/BizHawk ).
BizHawk is a .net-based multi-system emulator brought to you by some of the rerecording emulator principals. We wrote our own cue parsing/generating code to be able to handle any kind of junk we threw at it. Instead of trapping it in the emulator, we liberated it in the form of this tool, to be useful in other environments.
To use, drag a disc (.cue, .iso, .ccd, .cdi, .mds, .nrg) into the top area. DiscoHawk will dump a newly cleaned up CCD file set to the same directory as the original disc image, and call it _hawked.
<value>DiscoHawk converts bolloxed-up crusty disc images to totally tidy CCD.

DiscoHawk is part of the BizHawk project ( https://github.com/TASEmulators/BizHawk ).

BizHawk is a .net-based multi-system emulator brought to you by some of the rerecording emulator principals. We wrote our own cue parsing/generating code to be able to handle any kind of junk we threw at it. Instead of trapping it in the emulator, we liberated it in the form of this tool, to be useful in other environments.

To use, drag a disc (.cue, .iso, .ccd, .cdi, .mds, .nrg) into the top area. DiscoHawk will dump a newly cleaned up CCD file set to the same directory as the original disc image, and call it _hawked.

This is beta software. You are invited to report problems to our bug tracker or IRC. Problems consist of: crusty disc images that crash DiscoHawk or that cause DiscoHawk to produce a _hawked.ccd which fails to serve your particular purposes (which we will need to be informed of, in case we are outputting wrongly.)</value>
</data>
<data name="&gt;&gt;button1.Parent" xml:space="preserve">
<value>$this</value>
</data>
<data name="&gt;&gt;button1.Name" xml:space="preserve">
<value>button1</value>
</data>
<data name="button1.Text" xml:space="preserve">
<value>OK</value>
</data>
<data name="&gt;&gt;lblVersion.ZOrder" xml:space="preserve">
<value>0</value>
</data>
<data name="&gt;&gt;richTextBox1.Type" xml:space="preserve">
<value>System.Windows.Forms.RichTextBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;lblVersion.Type" xml:space="preserve">
<value>System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="button1.Location" type="System.Drawing.Point, System.Drawing">
<value>436, 234</value>
</data>
<data name="&gt;&gt;richTextBox1.Parent" xml:space="preserve">
<value>$this</value>
</data>
<metadata name="$this.Localizable" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
</root>
Loading