Skip to content

Commit

Permalink
Fix bad relativization of SGMv1 script path
Browse files Browse the repository at this point in the history
The script filename wasn't canonicalized before being made relative to
scripts/, which caused a bad path to be written to game.sgm if `main`
included a SphereFS prefix.
  • Loading branch information
fatcerberus committed Aug 16, 2017
1 parent 880d21b commit 6be1812
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,11 @@ miniSphere Changelog
vX.X.X - TBD
------------

* Fixes a bug where legacy `Spriteset#filename` includes a SphereFS prefix.
* Fixes a bug in the internal audio streaming logic which corrupted the output
of SoundStreams with more than one channel and made them sound choppy.
* Fixes a bug where legacy `Spriteset#filename` includes a SphereFS prefix.
* Fixes a bug where Cell will write an invalid script path to `game.sgm` if the
script filename includes the `@/` prefix.


v4.8.1 - August 14, 2017
Expand Down
10 changes: 5 additions & 5 deletions src/cell/build.c
Original file line number Diff line number Diff line change
Expand Up @@ -857,12 +857,12 @@ sort_targets_by_path(const void* p_a, const void* p_b)
static bool
write_manifests(build_t* build)
{
path_t* base_path;
duk_context* ctx;
FILE* file;
int height;
size_t json_size;
const char* json_text;
path_t* origin;
path_t* script_path;
int width;

Expand Down Expand Up @@ -914,10 +914,10 @@ write_manifests(build_t* build)
visor_end_op(build->visor);
return false;
}
script_path = path_new(duk_to_string(ctx, -1));
origin = path_new("scripts/");
path_relativize(script_path, origin);
path_free(origin);
script_path = fs_build_path(duk_to_string(ctx, -1), "@/");
base_path = path_new("@/scripts/");
path_relativize(script_path, base_path);
path_free(base_path);

// write game.sgm (SGMv1, for compatibility with Sphere 1.x)
file = fs_fopen(build->fs, "@/game.sgm", "wb");
Expand Down
2 changes: 1 addition & 1 deletion src/minisphere/audio.c
Original file line number Diff line number Diff line change
Expand Up @@ -117,9 +117,9 @@ audio_init(void)
return;
}
al_init_acodec_addon();
s_active_streams = vector_new(sizeof(stream_t*));
s_active_samples = vector_new(sizeof(struct sample_instance));
s_active_sounds = vector_new(sizeof(sound_t*));
s_active_streams = vector_new(sizeof(stream_t*));
}

void
Expand Down

0 comments on commit 6be1812

Please sign in to comment.