Fixed framefile reading bug, sound stopping when out of channels, added Windows icon and resources.
This commit is contained in:
parent
bd0ab45792
commit
b03a96f3b6
11 changed files with 58 additions and 8 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -36,3 +36,4 @@ games/
|
|||
build/
|
||||
singe/source.inc.sh
|
||||
singe/font.h
|
||||
singe/icon.h
|
||||
|
|
|
@ -56,7 +56,7 @@ function doBuild() {
|
|||
|
||||
TARGET="${SOURCE_DIR}/../build/${OSNAME}/${OSARCH}/${TARGET}${EXT}"
|
||||
echo "Linking ${TARGET}..."
|
||||
${CROSS}-g++ -o "${TARGET}" ${OFILES} "-L${SOURCE_DIR}/../thirdparty-build/${OSNAME}/${OSARCH}/installed/lib" ${EXTRA_LD_FLAGS}
|
||||
${CROSS}-g++ -o "${TARGET}" ${OFILES} ${EXTRA_OFILES} "-L${SOURCE_DIR}/../thirdparty-build/${OSNAME}/${OSARCH}/installed/lib" ${EXTRA_LD_FLAGS}
|
||||
|
||||
echo "Compressing ${TARGET}..."
|
||||
#${CROSS}-strip "${TARGET}"
|
||||
|
@ -68,10 +68,16 @@ function doBuild() {
|
|||
|
||||
CROSS="x86_64-linux-gnu"
|
||||
EXTRA_CFLAGS=""
|
||||
EXTRA_OFILES=""
|
||||
EXTRA_LD_FLAGS="-l:everything.a -lpthread -lXv -lX11 -lXext -lm -ldl -lrt"
|
||||
doBuild Singe-Linux-x86_64 linux 64
|
||||
|
||||
CROSS="x86_64-w64-mingw32"
|
||||
EXTRA_CFLAGS=""
|
||||
EXTRA_OFILES="/tmp/singe.res"
|
||||
EXTRA_LD_FLAGS="-mwindows -static -lmingw32 -l:everything.a -lm -lbcrypt -ldinput8 -ldxguid -ldxerr8 -luser32 -lgdi32 -lwinmm -limm32 -lole32 -loleaut32 -lshell32 -lsetupapi -lversion -luuid -Dmain=SDL_main"
|
||||
icotool -c -o /tmp/icon.ico icon.png
|
||||
x86_64-w64-mingw32-windres singe.rc -O coff -o /tmp/singe.res
|
||||
doBuild Singe-Windows-x86_64 mingw 64 .exe
|
||||
rm /tmp/icon.ico
|
||||
rm /tmp/singe.res
|
||||
|
|
|
@ -124,7 +124,7 @@ int frameFileLoad(char *filename, char *indexPath, bool stretchVideo, SDL_Render
|
|||
utilFixPathSeparators(&path);
|
||||
|
||||
// If it's not an absolute path, pre-pend the path to the framefile
|
||||
if (path[0] != utilGetPathSeparator()) {
|
||||
if ((path[0] != utilGetPathSeparator()) && (path[1] != ':')) {
|
||||
temp = path;
|
||||
count = strlen(filename) - strlen(utilGetLastPathComponent(filename));
|
||||
path = malloc(sizeof(char) * (count + strlen(temp) + 1));
|
||||
|
|
BIN
singe/icon.png
(Stored with Git LFS)
Normal file
BIN
singe/icon.png
(Stored with Git LFS)
Normal file
Binary file not shown.
10
singe/main.c
10
singe/main.c
|
@ -36,6 +36,7 @@
|
|||
#include "videoPlayer.h"
|
||||
#include "singe.h"
|
||||
#include "extensions.h"
|
||||
#include "icon.h"
|
||||
|
||||
|
||||
typedef struct RatioS {
|
||||
|
@ -119,6 +120,7 @@ int main(int argc, char *argv[]) {
|
|||
float bestRatio = 9999;
|
||||
SDL_Window *window = NULL;
|
||||
SDL_Renderer *renderer = NULL;
|
||||
SDL_Surface *icon = NULL;
|
||||
SDL_DisplayMode mode;
|
||||
static struct option options[] = {
|
||||
{ "nomouse", no_argument, NULL, 'm' },
|
||||
|
@ -478,7 +480,12 @@ int main(int argc, char *argv[]) {
|
|||
window = SDL_CreateWindow("SINGE", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, _confXResolution, _confYResolution, SDL_WINDOW_RESIZABLE);
|
||||
if (window == NULL) utilDie("%s", SDL_GetError());
|
||||
|
||||
//***TODO*** Window Icon
|
||||
// Window Icon
|
||||
icon = IMG_LoadPNG_RW(SDL_RWFromMem(icon_png, icon_png_len));
|
||||
if (icon == NULL) utilDie("%s", SDL_GetError());
|
||||
SDL_SetWindowIcon(window, icon);
|
||||
SDL_FreeSurface(icon);
|
||||
icon = NULL;
|
||||
|
||||
// Do we want full screen of some kind?
|
||||
if (_confFullScreen || _confFullScreenWindow) {
|
||||
|
@ -497,6 +504,7 @@ int main(int argc, char *argv[]) {
|
|||
// Create audio mixer device
|
||||
err = Mix_OpenAudio(44100, MIX_DEFAULT_FORMAT, 2, 44100 /* freq */ * 16 /* bits */ * 2 /* channels */ * 2 /* seconds */);
|
||||
if (err != 0) utilDie("%s", Mix_GetError());
|
||||
Mix_AllocateChannels(16);
|
||||
|
||||
// Start our video playback system
|
||||
if (frameFileInit()) utilDie("Unable to initialize framefile handler.");
|
||||
|
|
|
@ -405,3 +405,6 @@ fi
|
|||
|
||||
# === Overlay Font ===
|
||||
createEmbeddedBinary font.png font.h FONT_H
|
||||
|
||||
# === Window Icon ===
|
||||
createEmbeddedBinary icon.png icon.h ICON_H
|
||||
|
|
|
@ -1054,11 +1054,13 @@ int apiSoundPlay(lua_State *L) {
|
|||
// Get our sound structure
|
||||
HASH_FIND_INT(_soundList, &id, sound);
|
||||
if (!sound) luaDie(L, "soundPlay", "No sound at index %d in apiSoundPlay.", id);
|
||||
// Play it
|
||||
// Play it (can gracefully fail if we run out of channels)
|
||||
result = Mix_PlayChannel(-1, sound->chunk, 0);
|
||||
if (result >= 0) {
|
||||
Mix_Volume(result, _effectsVolume * 2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (sound) {
|
||||
luaTrace(L, "soundPlay", "%d", result);
|
||||
|
|
|
@ -29,8 +29,9 @@
|
|||
#include "common.h"
|
||||
|
||||
|
||||
// Don't forget to update singe.rc!
|
||||
#define SINGE_VERSION 2.00
|
||||
#define VERSION_STRING "v2.00b4"
|
||||
#define VERSION_STRING "v2.00b5"
|
||||
#define COPYRIGHT_END_YEAR "2020"
|
||||
|
||||
|
||||
|
|
|
@ -113,7 +113,9 @@ LIBS += \
|
|||
OTHER_FILES += \
|
||||
preBuild.sh \
|
||||
postLink.sh \
|
||||
buildRelease.sh
|
||||
buildRelease.sh \
|
||||
singe.rc
|
||||
|
||||
|
||||
#linux:QMAKE_POST_LINK += bash $$PWD/postLink.sh "$$PWD" "$$DESTDIR" "$$TARGET"
|
||||
|
||||
|
|
24
singe/singe.rc
Normal file
24
singe/singe.rc
Normal file
|
@ -0,0 +1,24 @@
|
|||
101 ICON "/tmp/icon.ico"
|
||||
1 VERSIONINFO
|
||||
FILEVERSION 2,0,0,0
|
||||
PRODUCTVERSION 2,0,0,0
|
||||
BEGIN
|
||||
BLOCK "StringFileInfo"
|
||||
BEGIN
|
||||
BLOCK "040904E4"
|
||||
BEGIN
|
||||
VALUE "CompanyName", "Kangaroo Punch Studios"
|
||||
VALUE "FileDescription", "Somewhat Interactive Nostalgic Game Emulator"
|
||||
VALUE "FileVersion", "2.0b5"
|
||||
VALUE "InternalName", "Singe"
|
||||
VALUE "LegalCopyright", "Copyright 2006-2020 Scott C. Duensing"
|
||||
VALUE "OriginalFilename", "singe.exe"
|
||||
VALUE "ProductName", "Singe"
|
||||
VALUE "ProductVersion", "2.0b5"
|
||||
END
|
||||
END
|
||||
BLOCK "VarFileInfo"
|
||||
BEGIN
|
||||
VALUE "Translation", 0x409, 1252
|
||||
END
|
||||
END
|
|
@ -232,7 +232,7 @@ char *utilReadLine(char *haystack, size_t length, char **offset) {
|
|||
bytes = tail - temp + 1;
|
||||
result = malloc(sizeof(char) * bytes);
|
||||
memcpy(result, temp, bytes - 1);
|
||||
result[bytes] = 0;
|
||||
result[bytes - 1] = 0;
|
||||
temp = tail;
|
||||
*offset = temp;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue