almost rendering correctly
This commit is contained in:
+3
-1
@@ -9,6 +9,7 @@ option(BUILD_SHARED_LIBS OFF)
|
||||
include_directories(external/ELFIO)
|
||||
include_directories(external/capstone/include)
|
||||
include_directories(external/cflags/include)
|
||||
include_directories(external/SDL/include)
|
||||
include_directories(external/xbyak)
|
||||
include_directories(external)
|
||||
|
||||
@@ -20,11 +21,12 @@ endif()
|
||||
set(CAPSTONE_ARCHITECTURE_DEFAULT OFF)
|
||||
set(CAPSTONE_PPC_SUPPORT ON)
|
||||
add_subdirectory(external/capstone)
|
||||
add_subdirectory(external/SDL)
|
||||
|
||||
add_executable(weee main.cpp core/mem.cpp core/loaders/elf.cpp
|
||||
core/loaders/dol.cpp
|
||||
core/broadway.cpp
|
||||
core/broadway/instructions.cpp
|
||||
core/broadway/mmio/vi.cpp)
|
||||
target_link_libraries(weee PUBLIC capstone)
|
||||
target_link_libraries(weee PUBLIC SDL3::SDL3 capstone)
|
||||
target_include_directories(weee PUBLIC core)
|
||||
+2
-1
@@ -66,6 +66,8 @@ struct mem {
|
||||
void copy(ircolib::u8 *src, const ircolib::u32 size, const ircolib::u32 offset);
|
||||
void set(const ircolib::u8 val, const ircolib::u32 size, const ircolib::u32 offset);
|
||||
|
||||
std::vector<ircolib::u8> mem1;
|
||||
|
||||
private:
|
||||
std::vector<read_handler<ircolib::u8>> read8_handlers{};
|
||||
std::vector<read_handler<ircolib::u16>> read16_handlers{};
|
||||
@@ -76,7 +78,6 @@ struct mem {
|
||||
std::vector<write_handler<ircolib::u32>> write32_handlers{};
|
||||
std::vector<write_handler<ircolib::u64>> write64_handlers{};
|
||||
|
||||
std::vector<ircolib::u8> mem1;
|
||||
video_interface vi;
|
||||
};
|
||||
} // namespace weee::core
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
#include <ircolib/log.hpp>
|
||||
#include <mem.hpp>
|
||||
#include <broadway.hpp>
|
||||
#include <SDL3/SDL.h>
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
weee::core::mem mem;
|
||||
@@ -30,8 +31,31 @@ int main(int argc, char **argv) {
|
||||
if (!flags.parse(argc, argv))
|
||||
return -1;
|
||||
|
||||
while (true)
|
||||
SDL_Init(SDL_INIT_VIDEO);
|
||||
SDL_Window *window = SDL_CreateWindow("weee", 800, 600, SDL_WINDOW_HIGH_PIXEL_DENSITY | SDL_WINDOW_RESIZABLE);
|
||||
SDL_Renderer *renderer = SDL_CreateRenderer(window, nullptr);
|
||||
SDL_Texture *texture = SDL_CreateTexture(renderer, SDL_PIXELFORMAT_RGBA32, SDL_TEXTUREACCESS_STREAMING, 640, 480);
|
||||
SDL_SetRenderDrawColor(renderer, 0, 0, 0, 0);
|
||||
SDL_SetRenderLogicalPresentation(renderer, 640, 480, SDL_LOGICAL_PRESENTATION_INTEGER_SCALE);
|
||||
|
||||
bool open = true;
|
||||
while (open) {
|
||||
broadway.run(mem);
|
||||
|
||||
SDL_Event e;
|
||||
while (SDL_PollEvent(&e)) {
|
||||
if (e.type == SDL_EVENT_QUIT)
|
||||
open = false;
|
||||
}
|
||||
|
||||
SDL_RenderClear(renderer);
|
||||
SDL_UpdateTexture(texture, nullptr, &mem.mem1[0x104000], 640 * 4);
|
||||
SDL_RenderTexture(renderer, texture, nullptr, nullptr);
|
||||
SDL_RenderPresent(renderer);
|
||||
}
|
||||
|
||||
SDL_DestroyWindow(window);
|
||||
SDL_Quit();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user