More SDL WIP.

This commit is contained in:
Andrea Odetti 2020-10-09 09:46:15 +01:00
parent ae0194d5b1
commit 8b081725ce
7 changed files with 34 additions and 29 deletions

View file

@ -49,7 +49,6 @@ add_library(appleii SHARED
linux/windows/dmusicc.cpp
linux/windows/winnls.cpp
linux/data.cpp
linux/benchmark.cpp
linux/paddle.cpp

View file

@ -24,6 +24,7 @@ target_include_directories(applen PRIVATE
${NCURSESW_INCLUDE_DIRS}
${LIBEVDEV_INCLUDE_DIRS}
${Boost_INCLUDE_DIRS}
${CMAKE_CURRENT_BINARY_DIR}
)
target_compile_options(applen PRIVATE

View file

@ -1,9 +1,9 @@
#include "StdAfx.h"
#include "Log.h"
HBITMAP LoadBitmap(HINSTANCE hInstance, const std::string & filename)
HBITMAP LoadBitmap(HINSTANCE hInstance, const char * filename)
{
LogFileOutput("LoadBitmap: not loading resource %s\n", filename.c_str());
LogFileOutput("LoadBitmap: not loading resource %s\n", filename);
return nullptr;
}

View file

@ -6,7 +6,7 @@
#include <libgen.h>
#include "Log.h"
#include "config.h"
#include "../ncurses/config.h"
namespace
{
@ -84,15 +84,3 @@ HRSRC FindResource(void *, const char * filename, const char *)
return result;
}
HBITMAP LoadBitmap(HINSTANCE hInstance, const char * filename)
{
LogFileOutput("LoadBitmap: not loading resource %s\n", filename);
return nullptr;
}
LONG GetBitmapBits(HBITMAP hbit, LONG cb, LPVOID lpvBits)
{
memset(lpvBits, 0, cb);
return cb;
}

View file

@ -18,6 +18,7 @@ target_compile_features(sa2 PUBLIC cxx_std_17)
target_include_directories(sa2 PRIVATE
${Boost_INCLUDE_DIRS}
${SDL2_INCLUDE_DIRS}
${CMAKE_CURRENT_BINARY_DIR}
)
target_link_libraries(sa2 PRIVATE
@ -26,8 +27,5 @@ target_link_libraries(sa2 PRIVATE
appleii
)
if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 9.0)
target_link_libraries(sa2 PRIVATE
stdc++fs
)
endif()
install(TARGETS sa2
DESTINATION bin)

View file

@ -20,19 +20,27 @@ std::string getPath(const std::string & resource)
return resource;
}
HBITMAP LoadBitmap(HINSTANCE hInstance, const std::string & resource)
HBITMAP LoadBitmap(HINSTANCE hInstance, const char * resource)
{
const std::string path = getPath(resource);
std::shared_ptr<SDL_Surface> surface(SDL_LoadBMP(path.c_str()), SDL_FreeSurface);
if (surface)
if (resource)
{
CBITMAP * bitmap = new CBITMAP;
bitmap->surface = surface;
return bitmap;
const std::string path = getPath(resource);
std::shared_ptr<SDL_Surface> surface(SDL_LoadBMP(path.c_str()), SDL_FreeSurface);
if (surface)
{
CBITMAP * bitmap = new CBITMAP;
bitmap->surface = surface;
return bitmap;
}
else
{
std::cerr << "Cannot load: " << resource << " with path: " << path << std::endl;
return nullptr;
}
}
else
{
std::cerr << "Cannot load: " << resource << " with path: " << path << std::endl;
std::cerr << "Cannot load invalid resource." << std::endl;
return nullptr;
}
}

View file

@ -23,6 +23,7 @@
#include "Video.h"
#include "NTSC.h"
#include "SaveState.h"
#include "RGBMonitor.h"
namespace
@ -48,6 +49,7 @@ namespace
MemInitialize();
VideoInitialize();
VideoSwitchVideocardPalette(RGB_GetVideocard(), GetVideoType());
g_CardMgr.GetDisk2CardMgr().Reset();
HD_Reset();
@ -283,3 +285,12 @@ int main(int, char**)
return exit;
}
// Mockingboard
void registerSoundBuffer(IDirectSoundBuffer * buffer)
{
}
void unregisterSoundBuffer(IDirectSoundBuffer * buffer)
{
}