mirror of
https://github.com/wheremyfoodat/Panda3DS.git
synced 2025-06-09 04:21:38 +12:00
More iOS work
This commit is contained in:
parent
ebefbdc4db
commit
1948bea209
4 changed files with 72 additions and 3 deletions
|
@ -57,6 +57,10 @@ void RendererMTL::reset() {
|
|||
}
|
||||
|
||||
void RendererMTL::display() {
|
||||
#ifdef PANDA3DS_IOS
|
||||
return;
|
||||
#endif
|
||||
|
||||
CA::MetalDrawable* drawable = metalLayer->nextDrawable();
|
||||
if (!drawable) {
|
||||
return;
|
||||
|
@ -126,11 +130,17 @@ void RendererMTL::display() {
|
|||
|
||||
void RendererMTL::initGraphicsContext(SDL_Window* window) {
|
||||
// TODO: what should be the type of the view?
|
||||
|
||||
#ifdef PANDA3DS_IOS
|
||||
// On iOS, the SwiftUI side handles device<->MTKView interaction
|
||||
device = MTL::CreateSystemDefaultDevice();
|
||||
#else
|
||||
void* view = SDL_Metal_CreateView(window);
|
||||
metalLayer = (CA::MetalLayer*)SDL_Metal_GetLayer(view);
|
||||
device = MTL::CreateSystemDefaultDevice();
|
||||
metalLayer->setDevice(device);
|
||||
commandQueue = device->newCommandQueue();
|
||||
#endif
|
||||
|
||||
// Textures
|
||||
MTL::TextureDescriptor* textureDescriptor = MTL::TextureDescriptor::alloc()->init();
|
||||
|
|
34
src/ios_driver.mm
Normal file
34
src/ios_driver.mm
Normal file
|
@ -0,0 +1,34 @@
|
|||
#import <Foundation/Foundation.h>
|
||||
|
||||
extern "C" {
|
||||
#include "ios_driver.h"
|
||||
}
|
||||
|
||||
#undef ABS
|
||||
#undef NO
|
||||
|
||||
#include <memory>
|
||||
#include "emulator.hpp"
|
||||
|
||||
#define IOS_EXPORT extern "C" __attribute__((visibility("default")))
|
||||
|
||||
std::unique_ptr<Emulator> emulator = nullptr;
|
||||
HIDService* hidService = nullptr;
|
||||
|
||||
extern "C" __attribute__((visibility("default"))) void iosCreateEmulator() {
|
||||
printf("Creating emulator\n");
|
||||
|
||||
emulator = std::make_unique<Emulator>();
|
||||
hidService = &emulator->getServiceManager().getHID();
|
||||
emulator->initGraphicsContext(nullptr);
|
||||
|
||||
// auto path = emulator->getAppDataRoot() / "Kirb Demo.3ds";
|
||||
auto path = emulator->getAppDataRoot() / "SimplerTri.elf";
|
||||
emulator->loadROM(path);
|
||||
|
||||
while (1) {
|
||||
emulator->runFrame();
|
||||
}
|
||||
|
||||
printf("Created emulator\n");
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue