smackw32: open SMK using harness (#452)
This fixes a case sensitivity issue on Linux
This commit is contained in:
parent
2e31fc6956
commit
33e49e8f0f
|
@ -45,6 +45,7 @@ typedef struct SmackTag {
|
|||
|
||||
// added by dethrace
|
||||
void* smk_handle; // opaque pointer to the libsmacker instance
|
||||
void *f; // opaque file pointer
|
||||
tAudioBackend_stream* audio_stream;
|
||||
} Smack;
|
||||
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
#include <string.h>
|
||||
|
||||
#include "harness/hooks.h"
|
||||
#include "harness/os.h"
|
||||
#include "harness/trace.h"
|
||||
|
||||
// lib/libsmacker
|
||||
|
@ -27,9 +28,15 @@ Smack* SmackOpen(const char* name, uint32_t flags, uint32_t extrabuf) {
|
|||
double microsecs_per_frame;
|
||||
Smack* smack;
|
||||
double fps;
|
||||
FILE *f = NULL;
|
||||
|
||||
smk smk_handle = smk_open_file(name, SMK_MODE_MEMORY);
|
||||
f = OS_fopen(name, "rb");
|
||||
if (f == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
smk smk_handle = smk_open_filepointer(f, SMK_MODE_MEMORY);
|
||||
if (smk_handle == NULL) {
|
||||
fclose(f);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -41,6 +48,8 @@ Smack* SmackOpen(const char* name, uint32_t flags, uint32_t extrabuf) {
|
|||
// smk_handle is added to hold a pointer to the underlying libsmacker instance
|
||||
smack->smk_handle = smk_handle;
|
||||
|
||||
smack->f = f;
|
||||
|
||||
smk_info_all(smk_handle, NULL, &smack->Frames, µsecs_per_frame);
|
||||
fps = 1000000.0 / microsecs_per_frame;
|
||||
smack->MSPerFrame = (unsigned long)((1 / fps) * 1000);
|
||||
|
@ -128,5 +137,6 @@ void SmackClose(Smack* smack) {
|
|||
}
|
||||
|
||||
smk_close(smack->smk_handle);
|
||||
// libsmacker closes file, no need to do `fclose(smack->f)`
|
||||
free(smack);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue