commit fbb775e553195ba891d3e7091ac6fdfc74335bcc
Merge: 85df4c9 647ae0a
Author: jtothebell <j.to.the.bell@gmail.com>
AuthorDate: Fri Apr 2 15:28:08 2021 -0600
Commit: jtothebell <j.to.the.bell@gmail.com>
CommitDate: Fri Apr 2 15:28:08 2021 -0600
Merge branch 'master' into SettingsIni
libs/z8lua | 2 +-
platform/3ds/source/3dsHost.cpp | 21 ++++++++------
platform/vita/Makefile | 2 +-
platform/vita/source/VitaHost.cpp | 6 ++++
platform/wiiu/source/WiiUHost.cpp | 1 +
source/graphics.cpp | 21 ++++++++------
source/graphics.h | 2 +-
source/p8GlobalLuaFunctions.h | 9 ------
source/picoluaapi.cpp | 23 ++++++++++-----
source/vm.cpp | 1 +
test/carts/boldtexttest.p8 | 36 +++++++++++++++++++++++
test/carts/nilpairstest.p8 | 24 ++++++++++++++++
test/carts/peek4test.p8 | 19 ++++++------
test/carts/screenshots/boldtexttest_f01.png | Bin 0 -> 550 bytes
test/carts/screenshots/nilpairstest_f01.png | Bin 0 -> 481 bytes
test/carts/screenshots/peek4test_f01.png | Bin 999 -> 0 bytes
test/carts/screenshots/peek4test_f02.png | Bin 0 -> 1061 bytes
test/carts/screenshots/splittest_f01.png | Bin 0 -> 604 bytes
test/carts/splittest.p8 | 25 ++++++++++++++++
test/endtoendtests.cpp | 43 +++++++++++++++++++++++++---
test/graphicstests.cpp | 19 ++++++++++++
21 files changed, 205 insertions(+), 49 deletions(-)
diff --cc platform/vita/Makefile
index 4e2a360,5281040..cfbbc50
--- a/platform/vita/Makefile
+++ b/platform/vita/Makefile
@@@ -5,10 -5,10 +5,10 @@@ PROJECT := fake_0
PHONY := all package clean
-SOURCES := ${SOURCES} source
+SOURCES := ${SOURCES} ../SDL2Common/source source
INCLUDES := ${INCLUDES}
- LIBS = -lSDL2 -lSceDisplay_stub -lSceCtrl_stub -lSceAudio_stub \
+ LIBS = -lSDL2 -lScePower_stub -lSceDisplay_stub -lSceCtrl_stub -lSceAudio_stub \
-lSceSysmodule_stub -lSceGxm_stub -lSceCommonDialog_stub \
-lSceAppMgr_stub -lSceTouch_stub -lSceHid_stub -lSceMotion_stub -lm
diff --cc platform/vita/source/VitaHost.cpp
index f5fe452,f114b5f..7001a65
--- a/platform/vita/source/VitaHost.cpp
+++ b/platform/vita/source/VitaHost.cpp
@@@ -53,30 -97,158 +54,35 @@@ const int JOYSTICK_DEAD_ZONE = 8000
int jxDir = 0;
int jyDir = 0;
-void postFlipFunction(){
- // We're done rendering, so we end the frame here.
- SDL_UnlockTexture(texture);
- SDL_RenderCopy(renderer, texture, NULL, &DestR);
-
- SDL_RenderPresent(renderer);
-}
-
-
-bool audioInitialized = false;
-
-void audioCleanup(){
- audioInitialized = false;
-
- SDL_CloseAudioDevice(dev);
-}
-
-void FillAudioDeviceBuffer(void* UserData, Uint8* DeviceBuffer, int Length)
-{
- _audio->FillAudioBuffer(DeviceBuffer, 0, Length / 4);
-}
-
-void audioSetup(){
- //modifed from SDL docs: https://wiki.libsdl.org/SDL_OpenAudioDevice
-
- SDL_memset(&want, 0, sizeof(want)); /* or SDL_zero(want) */
- want.freq = SAMPLERATE;
- want.format = AUDIO_S16;
- want.channels = 2;
- want.samples = 4096;
- want.callback = FillAudioDeviceBuffer;
-
-
- dev = SDL_OpenAudioDevice(NULL, 0, &want, &have, 0);
- if (dev == 0) {
- Logger_Write("Failed to open audio: %s", SDL_GetError());
- } else {
- if (have.format != want.format) { /* we let this one thing change. */
- Logger_Write("We didn't get requested audio format.");
- }
- SDL_PauseAudioDevice(dev, 0); /* start audio playing. */
-
- audioInitialized = true;
- }
-}
-
-Host::Host() { }
-
-
-void Host::oneTimeSetup(Color* paletteColors, Audio* audio){
- if (SDL_Init(SDL_INIT_EVERYTHING) != 0)
- {
- fprintf(stderr, "SDL could not initialize\n");
- quit = 1;
- return;
- }
-
- window = SDL_CreateWindow(nullptr, SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, 0, 0, SDL_WINDOW_FULLSCREEN_DESKTOP);
- if (!window)
- {
- quit = 1;
- return;
- }
-
- renderer = SDL_CreateRenderer(window, -1, SDL_RENDERER_ACCELERATED);
- if (!renderer)
- {
- quit = 1;
- return;
- }
-
- texture = SDL_CreateTexture(renderer, SDL_PIXELFORMAT_RGBA8888, SDL_TEXTUREACCESS_STREAMING, PicoScreenWidth, PicoScreenHeight);
- if (texture == NULL)
- {
- quit = 1;
- return;
- }
-
- atexit(SDL_Quit);
+SDL_Event event;
- DestR.x = WIN_WIDTH / 2 - SCREEN_SIZE_X / 2;
- DestR.y = WIN_HEIGHT / 2 - SCREEN_SIZE_Y / 2;
- DestR.w = SCREEN_SIZE_X;
- DestR.h = SCREEN_SIZE_Y;
- _audio = audio;
- audioSetup();
+string _desktopSdl2SettingsDir = "ux0:/data/fake08";
+string _desktopSdl2SettingsPrefix = "ux0:/data/fake08/";
+string _desktopSdl2customBiosLua = "cartpath = \"ux0:/p8carts/\"\n"
+ "selectbtn = \"x\"\n"
+ "pausebtn = \"start\"";
- for (int i = 0; i < SDL_NumJoysticks(); i++) {
- if (SDL_JoystickOpen(i) == NULL) {
- printf("Failed to open joystick %d!\n", i);
- quit = 1;
- }
- }
-
- last_time = 0;
- now_time = 0;
- frame_time = 0;
- targetFrameTimeMs = 0;
-
- _paletteColors = paletteColors;
+Host::Host() {
+ //make sure directories exists
+ sceIoMkdir("ux0:/data/", 0777);
+ sceIoMkdir("ux0:/data/fake08/", 0777);
+ scePowerSetArmClockFrequency( 444 );
+ scePowerSetBusClockFrequency( 222 );
+ scePowerSetGpuClockFrequency( 222 );
+ scePowerSetGpuXbarClockFrequency( 166 );
-}
-
-void Host::oneTimeCleanup(){
- audioCleanup();
-
- SDL_DestroyTexture(texture);
- SDL_DestroyRenderer(renderer);
- SDL_DestroyWindow(window);
- SDL_Quit();
-
- sceKernelExitProcess(0);
-}
-
-void Host::setTargetFps(int targetFps){
- targetFrameTimeMs = 1000 / targetFps;
-}
-
-void Host::changeStretch(){
- if (stretchKeyPressed) {
- if (stretch == PixelPerfectStretch) {
- stretch = PixelPerfect;
- screenWidth = PicoScreenWidth;
- screenHeight = PicoScreenHeight;
- }
- else if (stretch == PixelPerfect) {
- stretch = StretchToFit;
- screenWidth = WIN_HEIGHT;
- screenHeight = WIN_HEIGHT;
- }
- else if (stretch == StretchToFit) {
- stretch = StretchToFill;
- screenWidth = WIN_WIDTH;
- screenHeight = WIN_HEIGHT;
- }
- else if (stretch == StretchToFill) {
- stretch = PixelPerfectStretch;
- screenWidth = SCREEN_SIZE_X;
- screenHeight = SCREEN_SIZE_Y;
- }
+
- DestR.x = WIN_WIDTH / 2 - screenWidth / 2;
- DestR.y = WIN_HEIGHT / 2 - screenHeight / 2;
- DestR.w = screenWidth;
- DestR.h = screenHeight;
- }
+ setPlatformParams(
+ WINDOW_SIZE_X,
+ WINDOW_SIZE_Y,
+ WINDOW_FLAGS,
+ RENDERER_FLAGS,
+ PIXEL_FORMAT,
+ _desktopSdl2SettingsPrefix,
+ _desktopSdl2customBiosLua
+ );
}
InputState_t Host::scanInput(){