Created
January 31, 2021 22:44
-
-
Save leiradel/237207852703d0671cc42f5449ada3cf to your computer and use it in GitHub Desktop.
Lua script for the 48K Libretro core in HC
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local hc = require 'hc' | |
hc.control:addConsole('ZX Spectrum (Chips)', { | |
onConsoleLoaded = function() | |
local path = hc.config:getCoresPath() .. 'zx48k_libretro.' .. hc.soExtension | |
hc.control:loadCore(path) | |
end, | |
onGameLoaded = function() | |
local map = hc.config:getMemoryMap() | |
local blocks = {} | |
hc.logger:info('Adding memory region for System RAM') | |
for _, desc in pairs(map) do | |
blocks[#blocks + 1] = {desc.pointer, desc.start, desc.length} | |
hc.logger:info(' %p, %x, %d', desc.pointer, desc.start, desc.length) | |
end | |
hc.memory:addRegion('System RAM', false, table.unpack(blocks)) | |
end | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment