mirror of
https://github.com/phoboslab/wipeout-rewrite
synced 2024-12-26 09:59:04 +01:00
Load music and intro movie from the platform's asset path
This commit is contained in:
parent
b63b296f11
commit
0dae020303
5 changed files with 21 additions and 3 deletions
|
@ -10,6 +10,7 @@ bool platform_get_fullscreen(void);
|
||||||
void platform_set_fullscreen(bool fullscreen);
|
void platform_set_fullscreen(bool fullscreen);
|
||||||
void platform_set_audio_mix_cb(void (*cb)(float *buffer, uint32_t len));
|
void platform_set_audio_mix_cb(void (*cb)(float *buffer, uint32_t len));
|
||||||
|
|
||||||
|
FILE *platform_open_asset(const char *name, const char *mode);
|
||||||
uint8_t *platform_load_asset(const char *name, uint32_t *bytes_read);
|
uint8_t *platform_load_asset(const char *name, uint32_t *bytes_read);
|
||||||
uint8_t *platform_load_userdata(const char *name, uint32_t *bytes_read);
|
uint8_t *platform_load_userdata(const char *name, uint32_t *bytes_read);
|
||||||
uint32_t platform_store_userdata(const char *name, void *bytes, int32_t len);
|
uint32_t platform_store_userdata(const char *name, void *bytes, int32_t len);
|
||||||
|
|
|
@ -228,6 +228,11 @@ void platform_set_audio_mix_cb(void (*cb)(float *buffer, uint32_t len)) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
FILE *platform_open_asset(const char *name, const char *mode) {
|
||||||
|
char *path = strcat(strcpy(temp_path, path_assets), name);
|
||||||
|
return fopen(path, mode);
|
||||||
|
}
|
||||||
|
|
||||||
uint8_t *platform_load_asset(const char *name, uint32_t *bytes_read) {
|
uint8_t *platform_load_asset(const char *name, uint32_t *bytes_read) {
|
||||||
char *path = strcat(strcpy(temp_path, path_assets), name);
|
char *path = strcat(strcpy(temp_path, path_assets), name);
|
||||||
return file_load(path, bytes_read);
|
return file_load(path, bytes_read);
|
||||||
|
|
|
@ -264,6 +264,11 @@ void platform_set_audio_mix_cb(void (*cb)(float *buffer, uint32_t len)) {
|
||||||
audio_callback = cb;
|
audio_callback = cb;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
FILE *platform_open_asset(const char *name, const char *mode) {
|
||||||
|
char *path = strcat(strcpy(temp_path, path_assets), name);
|
||||||
|
return fopen(path, mode);
|
||||||
|
}
|
||||||
|
|
||||||
uint8_t *platform_load_asset(const char *name, uint32_t *bytes_read) {
|
uint8_t *platform_load_asset(const char *name, uint32_t *bytes_read) {
|
||||||
char *path = strcat(strcpy(temp_path, path_assets), name);
|
char *path = strcat(strcpy(temp_path, path_assets), name);
|
||||||
return file_load(path, bytes_read);
|
return file_load(path, bytes_read);
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
#include "../utils.h"
|
#include "../utils.h"
|
||||||
#include "../types.h"
|
#include "../types.h"
|
||||||
#include "../mem.h"
|
#include "../mem.h"
|
||||||
|
#include "../platform.h"
|
||||||
|
|
||||||
#include "intro.h"
|
#include "intro.h"
|
||||||
#include "ui.h"
|
#include "ui.h"
|
||||||
|
@ -36,7 +37,13 @@ static void audio_mix(float *samples, uint32_t len);
|
||||||
static void intro_end(void);
|
static void intro_end(void);
|
||||||
|
|
||||||
void intro_init(void) {
|
void intro_init(void) {
|
||||||
plm = plm_create_with_filename("wipeout/intro.mpeg");
|
FILE *file = platform_open_asset("wipeout/intro.mpeg", "rb");
|
||||||
|
if (!file) {
|
||||||
|
intro_end();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
plm = plm_create_with_file(file, true);
|
||||||
if (!plm) {
|
if (!plm) {
|
||||||
intro_end();
|
intro_end();
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -251,8 +251,8 @@ void sfx_music_open(char *path) {
|
||||||
fclose(music->file);
|
fclose(music->file);
|
||||||
music->file = NULL;
|
music->file = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
FILE *file = fopen(path, "rb");
|
FILE *file = platform_open_asset(path, "rb");
|
||||||
if (!file) {
|
if (!file) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue