Fix sa2 to work with recent code.
Signed-off-by: Andrea Odetti <mariofutire@gmail.com>
This commit is contained in:
parent
697a5b5c88
commit
274ef6a796
4 changed files with 30 additions and 18 deletions
|
@ -25,7 +25,7 @@ namespace
|
|||
}
|
||||
}
|
||||
|
||||
std::string getResourcePath()
|
||||
std::string getResourcePathImpl()
|
||||
{
|
||||
char self[1024] = {0};
|
||||
const int ch = readlink("/proc/self/exe", self, sizeof(self));
|
||||
|
@ -51,7 +51,12 @@ namespace
|
|||
return std::string();
|
||||
}
|
||||
|
||||
const std::string resourcePath = getResourcePath();
|
||||
}
|
||||
|
||||
const std::string & getResourcePath()
|
||||
{
|
||||
static const std::string path = getResourcePathImpl();
|
||||
return path;
|
||||
}
|
||||
|
||||
HRSRC FindResource(void *, const char * filename, const char *)
|
||||
|
@ -60,7 +65,7 @@ HRSRC FindResource(void *, const char * filename, const char *)
|
|||
|
||||
if (filename)
|
||||
{
|
||||
const std::string path = resourcePath + filename;
|
||||
const std::string path = getResourcePath() + filename;
|
||||
|
||||
int fd = open(path.c_str(), O_RDONLY);
|
||||
|
||||
|
|
3
source/frontends/ncurses/resources.h
Normal file
3
source/frontends/ncurses/resources.h
Normal file
|
@ -0,0 +1,3 @@
|
|||
#include <string>
|
||||
|
||||
const std::string & getResourcePath();
|
|
@ -4,18 +4,19 @@
|
|||
|
||||
#include <linux/interface.h>
|
||||
#include <linux/windows/misc.h>
|
||||
#include <frontends/ncurses/resources.h>
|
||||
|
||||
struct CBITMAP : public CHANDLE
|
||||
{
|
||||
std::shared_ptr<SDL_Surface> surface;
|
||||
};
|
||||
|
||||
std::string getPath(const std::string & resource)
|
||||
std::string getFilename(const std::string & resource)
|
||||
{
|
||||
if (resource == "CHARSET40") return "resource/CHARSET4.BMP";
|
||||
if (resource == "CHARSET82") return "resource/CHARSET82.bmp";
|
||||
if (resource == "CHARSET8M") return "resource/CHARSET8M.bmp";
|
||||
if (resource == "CHARSET8C") return "resource/CHARSET8C.bmp";
|
||||
if (resource == "CHARSET40") return "CHARSET4.BMP";
|
||||
if (resource == "CHARSET82") return "CHARSET82.bmp";
|
||||
if (resource == "CHARSET8M") return "CHARSET8M.bmp";
|
||||
if (resource == "CHARSET8C") return "CHARSET8C.bmp";
|
||||
|
||||
return resource;
|
||||
}
|
||||
|
@ -24,7 +25,9 @@ HBITMAP LoadBitmap(HINSTANCE hInstance, const char * resource)
|
|||
{
|
||||
if (resource)
|
||||
{
|
||||
const std::string path = getPath(resource);
|
||||
const std::string filename = getFilename(resource);
|
||||
const std::string path = getResourcePath() + filename;
|
||||
|
||||
std::shared_ptr<SDL_Surface> surface(SDL_LoadBMP(path.c_str()), SDL_FreeSurface);
|
||||
if (surface)
|
||||
{
|
||||
|
|
|
@ -164,6 +164,16 @@ BYTE SpkrToggle (WORD pc, WORD addr, BYTE bWrite, BYTE d, ULONG uExecutedCycles)
|
|||
return MemReadFloatingBus(uExecutedCycles);
|
||||
}
|
||||
|
||||
|
||||
// Mockingboard
|
||||
void registerSoundBuffer(IDirectSoundBuffer * buffer)
|
||||
{
|
||||
}
|
||||
|
||||
void unregisterSoundBuffer(IDirectSoundBuffer * buffer)
|
||||
{
|
||||
}
|
||||
|
||||
void run_sdl()
|
||||
{
|
||||
InitializeRegistry("applen.conf");
|
||||
|
@ -285,12 +295,3 @@ int main(int, char**)
|
|||
|
||||
return exit;
|
||||
}
|
||||
|
||||
// Mockingboard
|
||||
void registerSoundBuffer(IDirectSoundBuffer * buffer)
|
||||
{
|
||||
}
|
||||
|
||||
void unregisterSoundBuffer(IDirectSoundBuffer * buffer)
|
||||
{
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue