Skip to content

Commit

Permalink
v0.60 is here
Browse files Browse the repository at this point in the history
* bugfixes :
    * remove screenshot path warning.
    * use "ref struct" instead of "class" SongPlayerInfo.
    * rename ImageWritterWrite:ImageAndFree method to ImageWritterWrite::PNGImageAndFree because screenshots are saved in PNG format.
    * fix seeking paused short streams which triggers play.
    * restore SOUNDBRIDGE_MIN_DURATION_KEEP_ALIVE constant value, it was changed for testing in past commit.
* the JS version of the engine now contains settings menu, master volume, keyboard bindings and expansions support.
* show savemanager on startup always if the number of emulated vmu is greater than 1.
* various improvements to layoutvisor including an file/folder picker for easy usage.
* update screenshots
* update readme
* remove unused dlls
  • Loading branch information
kapodamy committed Jul 7, 2023
1 parent c29727c commit 7815650
Show file tree
Hide file tree
Showing 17 changed files with 33 additions and 30 deletions.
7 changes: 2 additions & 5 deletions README.MD
Original file line number Diff line number Diff line change
Expand Up @@ -47,15 +47,12 @@ Explained here [FEATURES.MD](FEATURES.MD "FEATURES.MD")
![week tutorial](test%20files/kdmy%20pics/screenshots/week%20tutorial.png)
![pause](test%20files/kdmy%20pics/screenshots/pause.png)
![weekselector](test%20files/kdmy%20pics/screenshots/weekselector.png)
![settingsmenu](test%20files/kdmy%20pics/screenshots/2022-10-28T220952.760.png)
![layoutvisor](test%20files/kdmy%20pics/screenshots/Opera%20Captura%20de%20pantalla_2023-07-07_012455_kdmy_engine_layout_visor.html.png)

## ¿What is missing?

* ~~Post-processing shaders~~. ¡DONE!
* ~~Dialogues (waht a shame)~~. ¡DONE!
* ~~Expansions loader (a.k.a mods loader).~~. ¡DONE!
* ~~Lua API to manipulate strums, states and UI cosmetics~~. ¡DONE!
* Documentation (only a part is documented).
* ~~Video playback (kinda optional).~~ ¡DONE!

## How to compile

Expand Down
4 changes: 2 additions & 2 deletions src-desktop/kdy-e/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,6 @@
// Puede especificar todos los valores o usar los valores predeterminados de número de compilación y de revisión
// utilizando el carácter "*", como se muestra a continuación:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("0.57.0.0")]
[assembly: AssemblyFileVersion("0.57.0.0")]
[assembly: AssemblyVersion("0.60.0.0")]
[assembly: AssemblyFileVersion("0.60.0.0")]
[assembly: NeutralResourcesLanguage("es-419")]
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ static int script_songplayer_play(LuaState L) {
SongPlayer songplayer = L.ReadUserdata<SongPlayer>(SONGPLAYER);

SongPlayerInfo songinfo_dummy = new SongPlayerInfo();
songplayer.Play(songinfo_dummy);
songplayer.Play(ref songinfo_dummy);

return 0;
}
Expand Down
4 changes: 2 additions & 2 deletions src-desktop/kdy-e/engine/game/gameplay/week.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2451,7 +2451,7 @@ public static int Round(RoundContext roundcontext, bool from_retry, bool show_di

// start this round!!!!!
dettached_controller_index = -1;
double elapsed_play = roundcontext.songplayer != null ? roundcontext.songplayer.Play(songinfo) : 0.0;
double elapsed_play = roundcontext.songplayer != null ? roundcontext.songplayer.Play(ref songinfo) : 0.0;

// prepare beatwatchers
BeatWatcher.GlobalSetTimestamp(elapsed_play);
Expand Down Expand Up @@ -2529,7 +2529,7 @@ public static int Round(RoundContext roundcontext, bool from_retry, bool show_di

if (roundcontext.songplayer != null) {
roundcontext.songplayer.Seek(song_timestamp);
roundcontext.songplayer.Play(songinfo);
roundcontext.songplayer.Play(ref songinfo);
}

for (int i = 0 ; i < roundcontext.players_size ; i++) {
Expand Down
2 changes: 1 addition & 1 deletion src-desktop/kdy-e/engine/game/main.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public static class GameMain {

// this file contains all shared data across the game
public const string ENGINE_NAME = "kdmy-engine";
public const string ENGINE_VERSION = "0.58";
public const string ENGINE_VERSION = "0.60";

/**
* The background music used in all menus, inherited from introscreen
Expand Down
7 changes: 4 additions & 3 deletions src-desktop/kdy-e/engine/platform/pvrctx.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using System;
using System.Diagnostics;
using System.IO;
using CsharpWrapper;
using Engine.Externals;
using Engine.Externals.GLFW;
Expand Down Expand Up @@ -798,12 +799,12 @@ public static void TakeScreenshot() {
nint ptr = PVRContext.global_context.webopengl.ReadFrameBuffer(out width, out height);
if (ptr == 0x00) return;

string filename = "../screenshots/" + DateTime.Now.ToString("yyyy-MM-ddTHHmmss.fff") + ".png";
filename = IO.GetAbsolutePath(filename, true, false, false);
string filename = DateTime.Now.ToString("yyyy-MM-ddTHHmmss.fff") + ".png";
filename = $"{EngineSettings.EngineDir}screenshots{Path.DirectorySeparatorChar}{filename}";

// async file writting to avoid suttering
Engine.Game.GameMain.SpawnCoroutine(null, delegate (object param) {
ImageWritter.WriteImageAndFree(ptr, width, height, true, filename);
ImageWritter.WritePNGImageAndFree(ptr, width, height, true, filename);
return null;
}, null);
}
Expand Down
4 changes: 2 additions & 2 deletions src-desktop/kdy-e/engine/sound/songplayer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

namespace Engine.Sound;

public class SongPlayerInfo {
public ref struct SongPlayerInfo {
public double timestamp;
public bool completed;
}
Expand Down Expand Up @@ -111,7 +111,7 @@ public void Destroy() {
//free(songplayer);
}

public double Play(SongPlayerInfo songinfo) {
public double Play(ref SongPlayerInfo songinfo) {
if (this.playbacks_size < 1 || !this.paused) return 0.0;

double lowest_timestamp = double.PositiveInfinity;
Expand Down
2 changes: 1 addition & 1 deletion src-desktop/kdy-e/kdy-e.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<UseCurrentRuntimeIdentifier>false</UseCurrentRuntimeIdentifier>
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
<AppendRuntimeIdentifierToOutputPath>false</AppendRuntimeIdentifierToOutputPath>
<OutputType>Exe</OutputType>
<OutputType>WinExe</OutputType>
</PropertyGroup>
<PropertyGroup>
<SignManifests>false</SignManifests>
Expand Down
4 changes: 2 additions & 2 deletions src-desktop/soundbridge/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,5 @@
// Puede especificar todos los valores o usar los valores predeterminados de número de compilación y de revisión
// utilizando el carácter "*", como se muestra a continuación:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.6.0.0")]
[assembly: AssemblyFileVersion("1.6.0.0")]
[assembly: AssemblyVersion("1.6.1.0")]
[assembly: AssemblyFileVersion("1.6.1.0")]
19 changes: 12 additions & 7 deletions src-desktop/soundbridge/sndbridge.cs
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ public double Position {
}
break;
default:
SoundBridge.PrintPaError($"sndbridge_position() failed on stream {this.id}: ", (PaError)err);
SoundBridge.PrintPaError($"sndbridge_position() failed on stream {this.id}: ", err);
return -1.0;
}

Expand All @@ -106,7 +106,7 @@ public void Seek(double seconds) {

int status = PortAudio.Pa_IsStreamActive(this.pastream);
if (status != 1 && status != 0) {
SoundBridge.PrintPaError($"sndbridge_seek() status failed on stream {this.id}: ", (PaError)status);
SoundBridge.PrintPaError($"sndbridge_seek() status failed on stream {this.id}: ", status);
return;
}

Expand All @@ -117,6 +117,7 @@ public void Seek(double seconds) {
}
}

bool has_halt = this.halt;
if (this.keep_alive) SoundBridge.wait_and_halt(this, status == 1);

this.buffer_used = 0;
Expand All @@ -137,7 +138,7 @@ public void Seek(double seconds) {

if (status == 1) {
if (this.keep_alive) {
this.halt = false;
if (!has_halt) this.halt = false;
return;
}

Expand All @@ -161,7 +162,7 @@ public void Play() {
case 0:
break;
default:
SoundBridge.PrintPaError($"sndbridge_play() status failed on stream {this.id}: ", (PaError)err);
SoundBridge.PrintPaError($"sndbridge_play() status failed on stream {this.id}: ", err);
return;
}

Expand Down Expand Up @@ -193,7 +194,7 @@ public void Pause() {
if (this.halt) return;
break;
default:
SoundBridge.PrintPaError($"sndbridge_pause() status failed on stream {this.id}: ", (PaError)err);
SoundBridge.PrintPaError($"sndbridge_pause() status failed on stream {this.id}: ", err);
return;
}

Expand Down Expand Up @@ -227,7 +228,7 @@ public void Stop() {
if (this.keep_alive) goto L_reset_stream;
break;
default:
SoundBridge.PrintPaError("sndbridge_stop() status failed on stream {this.id}: ", (PaError)err);
SoundBridge.PrintPaError("sndbridge_stop() status failed on stream {this.id}: ", err);
return;
}

Expand Down Expand Up @@ -332,7 +333,7 @@ public static class SoundBridge {
private const float PI_HALF = MathF.PI / 2f;
private const string DESIRED_API_NAME = "DSound";
private const PaHostApiTypeId DESIRED_API_ENUM = PaHostApiTypeId.paDirectSound;
private const float MIN_DURATION_KEEP_ALIVE = 99990.500f; // 500 milliseconds
private const float MIN_DURATION_KEEP_ALIVE = 0.500f; // 500 milliseconds
private const int WAIT_AND_HALT_TIMEOUT = 1000; // 1000 milliseconds


Expand Down Expand Up @@ -360,6 +361,10 @@ internal static void wait_and_halt(Stream stream, bool halt) {
stream.halt = halt;
}

internal static void PrintPaError(string str, int err) {
PrintPaError(str, (PaError)err);
}

internal static void PrintPaError(string str, PaError err) {
Logger.Error($"soundbridge: {str}{PortAudio.Pa_GetErrorText(err)}");
}
Expand Down
4 changes: 2 additions & 2 deletions src-desktop/texture-mgr/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,5 @@
// Puede especificar todos los valores o usar los valores predeterminados de número de compilación y de revisión
// utilizando el carácter "*", como se muestra a continuación:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.5.0.0")]
[assembly: AssemblyFileVersion("1.5.0.0")]
[assembly: AssemblyVersion("1.5.1.0")]
[assembly: AssemblyFileVersion("1.5.1.0")]
2 changes: 1 addition & 1 deletion src-desktop/texture-mgr/imagewritter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ namespace Engine.Platform;

public class ImageWritter {

public static void WriteImageAndFree(nint rgba_pixels, int width, int height, bool flip_y, string filename) {
public static void WritePNGImageAndFree(nint rgba_pixels, int width, int height, bool flip_y, string filename) {
int stride = width * sizeof(uint);
int length = width * height;
string dir = Path.GetDirectoryName(filename);
Expand Down
2 changes: 1 addition & 1 deletion src-javascript/engine/game/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

// this file contains all shared data across the game
const ENGINE_NAME = "kdmy-engine";
const ENGINE_VERSION = "0.58";
const ENGINE_VERSION = "0.60";


/**
Expand Down
Binary file modified test files/kdmy pics/files.PNG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.

0 comments on commit 7815650

Please sign in to comment.