1 2 3 4 5
8 9
Editor, Emulator Coder
Joined: 8/7/2008
Posts: 1156
Didn't you understand "here isn't a hook for X"? Try checking whether the window is visible to see if the user closed it
Editor, Expert player (2330)
Joined: 5/15/2007
Posts: 3933
Location: Germany
zeromus wrote:
Try checking whether the window is visible to see if the user closed it
how
Joined: 10/23/2009
Posts: 545
Location: Where?
So, I discovered the client.SetCclientExtraPadding function, which sounds like something that gives more place to put text(especially on the side of the screen). So I moved some of my text to the extra space, but it doesn't appear there. It's like it's "just" black space added. I think I miss a function or I miss something else. Basically, I'd like to display coordinates and other stuff on the sides of the game screen instead of on the game screen.
Editor, Emulator Coder
Joined: 8/7/2008
Posts: 1156
with gui.text, it can appear in the extra space. with gui.renderstring or something like that, it can appear in the extra space only if you set the rendering surface to the client area (which it isn't by default). if you render to the 'native' surface then the padding doesn't exist yet when it's rendered; its added later in the 'client' part
Joined: 10/23/2009
Posts: 545
Location: Where?
zeromus wrote:
with gui.text, it can appear in the extra space. with gui.renderstring or something like that, it can appear in the extra space only if you set the rendering surface to the client area (which it isn't by default). if you render to the 'native' surface then the padding doesn't exist yet when it's rendered; its added later in the 'client' part
I've tried with gui.text, it does works, but it bothers me that it's dependent on the window size. I'd like to use gui.pixelText.(I'd like to transfer what I've done currently with pixeltext and gui.drawlines to that new area if it's possible) I'm not sure how to set the rendering surface by defaut. I've looked at the functions of the client section and haven't seen something that seem to do that. And I'm not sure to understand the last sentence.
Editor, Emulator Coder
Joined: 8/7/2008
Posts: 1156
gui.DrawNew("native"); --how to set the rendering surface by defaut.
gui.pixelText(0,20,"hi2u",0xff00ff00)
This depends on window size too.... if you want to render in a way that doesn't depend on window size then why are you using setclientextrapadding? use setgameextrapadding instead.
Joined: 10/23/2009
Posts: 545
Location: Where?
zeromus wrote:
gui.DrawNew("native"); --how to set the rendering surface by defaut.
gui.pixelText(0,20,"hi2u",0xff00ff00)
This depends on window size too.... if you want to render in a way that doesn't depend on window size then why are you using setclientextrapadding? use setgameextrapadding instead.
I've tried setgameextrapadding one time, and it stretched the game if I recall correctly. Thank for the sample, I'll try out later.
Editor, Emulator Coder
Joined: 8/7/2008
Posts: 1156
bugs happen, bugs get fixed.
Editor, Expert player (2330)
Joined: 5/15/2007
Posts: 3933
Location: Germany
It looks like the stretching can be worked around by turning off "stretch by integers only" in Display > Config. Otherwise, wait for the next Bizhawk version
Joined: 10/23/2009
Posts: 545
Location: Where?
Ohhh okay I thought it was a different function. Thanks! I'll wait for the next version and try out. I need to wait for the next version anyway. EDIT: According to this link at the savestate tab, there is no function that returns the current loaded slot. http://tasvideos.org/Bizhawk/LuaFunctions.html. I assume there is none yet? EDIT:
zeromus wrote:
bugs happen, bugs get fixed.
Concerning this, It seems to be when the four parameters aren't the same.
Editor, Expert player (2330)
Joined: 5/15/2007
Posts: 3933
Location: Germany
I need help with a luascript I made for GB Motocross Maniacs. There are items you can collect throughout the course but some of them can be hidden. I want to show hidden items on screen. Starting at $CA00 are item slots, with 4 bytes, each byte tells respectively: - kind of item - amount? - ypos - xpos But since the position values are only 1 byte, I don't know what to do to determine at what point in the course it should be displayed. I would appreciate help http://pastebin.com/2vd6nnGU
Joined: 10/23/2009
Posts: 545
Location: Where?
Maybe you need to find out in which portion of the map the item is(The map could be divided in sections)? One another way would be to find if there is an address that tells to the item to be on screen range or not?
Editor, Emulator Coder
Joined: 8/7/2008
Posts: 1156
My guess would be theyre related to the current scroll values, and don't exist (not spawned in) until the map is scrolled to the right "section", but if youre even having this problem, it would mean theyre existing way too early?
Joined: 10/23/2009
Posts: 545
Location: Where?
So, I need to display the past values of an address to ease some work. But I don't know how. I'd like to display something like that: -4 frame: Past Value from that frame -3 frame :Past value from that frame -2 frame :Past value from that frame -1 frame :past value from that frame Current frame: current value Is it too demanding? I've looked for a function in mainmemory that fetch that value, but except reading that, I did not find any function that seemed to do what I'd like to do. I thought about something that gets written somewhere in the lua script, but I'm not sure if that's a good idea or a valid idea. I've never did anything like that before.
Editor, Emulator Coder
Joined: 8/7/2008
Posts: 1156
build a size 4 fifo in lua; capture the value each frame and enqueue it. contents of fifo are always last 4 frames.
Editor, Expert player (2330)
Joined: 5/15/2007
Posts: 3933
Location: Germany
You can do something like this. But it will not remember the values from previous frames when you load a state. I did not figure out my item display stuff yet btw.. not that it matters too much.
Language: Lua

function text(x, y, text, color) gui.pixelText(x, y, text,color,0x00000000) end valuetable = { [0] = "-", -- current frame [1] = "-", -- previous frame [2] = "-", -- frame before that [3] = "-" -- frame before that } event.onloadstate(function() valuetable = { [0] = "-", [1] = "-", [2] = "-", [3] = "-" } end) while true do testvalue = memory.read_u16_le(0xc900) valuetable[3] = valuetable[2] valuetable[2] = valuetable[1] valuetable[1] = valuetable[0] valuetable[0] = testvalue text(80,38,valuetable[0],0xFF000000) text(80,48,valuetable[1],0xFF000000) text(80,58,valuetable[2],0xFF000000) text(80,68,valuetable[3],0xFF000000) emu.frameadvance() end
Joined: 10/23/2009
Posts: 545
Location: Where?
Thanks a lot, that's exactly what I wanted to do. :)
Site Admin, Skilled player (1254)
Joined: 4/17/2010
Posts: 11478
Location: Lake Char­gogg­a­gogg­man­chaugg­a­gogg­chau­bun­a­gung­a­maugg
MUGG wrote:
But it will not remember the values from previous frames when you load a state.
It will. userdata.set(), userdata.get().
Warning: When making decisions, I try to collect as much data as possible before actually deciding. I try to abstract away and see the principles behind real world events and people's opinions. I try to generalize them and turn into something clear and reusable. I hate depending on unpredictable and having to make lottery guesses. Any problem can be solved by systems thinking and acting.
Joined: 10/23/2009
Posts: 545
Location: Where?
Is there a function to do that : event.onloadstate(function() With branches? Something like: event.onloadbranch(function()
Site Admin, Skilled player (1254)
Joined: 4/17/2010
Posts: 11478
Location: Lake Char­gogg­a­gogg­man­chaugg­a­gogg­chau­bun­a­gung­a­maugg
Hm, nothing like this, only tastudio.setbranchtext(). You can also use marker functions.
Warning: When making decisions, I try to collect as much data as possible before actually deciding. I try to abstract away and see the principles behind real world events and people's opinions. I try to generalize them and turn into something clear and reusable. I hate depending on unpredictable and having to make lottery guesses. Any problem can be solved by systems thinking and acting.
Editor, Expert player (2330)
Joined: 5/15/2007
Posts: 3933
Location: Germany
Language: Lua

memory.usememorydomain("EWRAM") write_1E90 = function() client.pause() print(emu.framecount()..": Write occured.") end read_1E90 = function() client.pause() print(emu.framecount()..": Read occured.") end exec_1E90 = function() client.pause() print(emu.framecount()..": Exec occured.") end event.onmemorywrite(write_1E90,0x1E90) event.onmemoryread(read_1E90,0x1E90) event.onmemoryexecute(exec_1E90,0x1E90) while true do emu.frameadvance() end
When writing to 0x001E90, it should do the print but it doesn't. What gives? Looking for a way to do subframe resets or at least get close to it. Is it possible for GBA games?
Editor, Emulator Coder
Joined: 8/7/2008
Posts: 1156
i doubt this scenario works in bizhawk. you can't interrupt the emulation of a frame. We're currently discussing ideas for how to improve this in the future.
Site Admin, Skilled player (1254)
Joined: 4/17/2010
Posts: 11478
Location: Lake Char­gogg­a­gogg­man­chaugg­a­gogg­chau­bun­a­gung­a­maugg
What if you don't pause? For other cores it worked for me.
Warning: When making decisions, I try to collect as much data as possible before actually deciding. I try to abstract away and see the principles behind real world events and people's opinions. I try to generalize them and turn into something clear and reusable. I hate depending on unpredictable and having to make lottery guesses. Any problem can be solved by systems thinking and acting.
Editor, Expert player (2330)
Joined: 5/15/2007
Posts: 3933
Location: Germany
feos wrote:
What if you don't pause? For other cores it worked for me.
Why would that be of consequence? New inquiry: How to get file path of currently loaded script?
Site Admin, Skilled player (1254)
Joined: 4/17/2010
Posts: 11478
Location: Lake Char­gogg­a­gogg­man­chaugg­a­gogg­chau­bun­a­gung­a­maugg
If it still wouldn't work, it'd mean that the core simply doesn't support memory hooks.
Warning: When making decisions, I try to collect as much data as possible before actually deciding. I try to abstract away and see the principles behind real world events and people's opinions. I try to generalize them and turn into something clear and reusable. I hate depending on unpredictable and having to make lottery guesses. Any problem can be solved by systems thinking and acting.
1 2 3 4 5
8 9