Detecting 2 Player screen splitting

Description: Archive discussion
============================
Original description:
Official subforum for LunaLua - an extension framework for SMBX Engine Version 1.3 (which a core of SMBX 2.0). Share your creations that require the use of LunaLUA. You may also share info/tutorials on how to use LunaLUA.

Sambo M
Topic author, Count
Count
Avatar
Sambo M
Topic author, Count
Count
Age: 25
Reputation: 15
Posts: 264
Joined: 27 Jun 2014

Post #1by Sambo » 12 Mar 2015, 7:17

Is it possible to detect when the screen has split in 2 player mode with lunaLUA? I'm trying to make a custom HUD that works in 2-player mode.

Also, is it possible to load a different image into each player's screen? Currently, the same image will be loaded into both screens at the same position when the placeSprite function is used.
Image
Current Project:
Image

Veudekato M
Viscount
Viscount
Avatar
Veudekato M
Viscount
Viscount
Reputation: 79
Posts: 369
Joined: 19 Feb 2014
Location: Russia

Post #2by Veudekato » 12 Mar 2015, 11:44

I think no yet,or never. Becouse split is not memory (yes?)
My channel (PlatGEnWohl news and tutorials , smbx tests):
http://www.youtube.com/channel/UC6h-42umT14iR1wa3VkOs3Q

Sambo M
Topic author, Count
Count
Avatar
Sambo M
Topic author, Count
Count
Age: 25
Reputation: 15
Posts: 264
Joined: 27 Jun 2014

Post #3by Sambo » 13 Mar 2015, 8:23

There must be a memory address for "is screen split" somewhere in SMBX. Every function of a program has a memory address.
Image
Current Project:
Image

Kevsoft M
Angry developer
Angry developer
Avatar
Kevsoft M
Angry developer
Angry developer
Age: 24
Reputation: 93
Posts: 379
Joined: 26 Apr 2014
Location: Austria
Website

Post #4by Kevsoft » 14 Mar 2015, 23:53

After some searching:

Code: Select all

-- 0 = is not split
-- -1 (0xFFFF) = is split
local isSplit = mem(mem(0x00B25124, FIELD_DWORD)+144, FIELD_WORD)
▬▬▬▬▬▬▬▬▬▬ஜ۩۞۩ஜ▬▬▬▬▬▬▬▬ Signature.start() ▬▬▬▬▬▬▬▬▬▬ஜ۩۞۩ஜ▬▬▬▬▬▬▬
▬▬▬▬▬▬▬▬▬▬ஜ۩۞۩ஜ▬▬▬▬▬▬▬▬ Signature.end() ▬▬▬▬▬▬▬▬▬▬ஜ۩۞۩ஜ▬▬▬▬▬▬▬▬

Sambo M
Topic author, Count
Count
Avatar
Sambo M
Topic author, Count
Count
Age: 25
Reputation: 15
Posts: 264
Joined: 27 Jun 2014

Post #5by Sambo » 16 Mar 2015, 7:11

Thanks. :) What did you do to figure that out? I think it could be useful to know.
Is there a way to tell the direction in which the screen has split?

Also, since you're the creator of LunaLUA, you probably know this. Is it possible to load an image only on player 1's screen or on player 2's screen and not both?
Image
Current Project:
Image

Kevsoft M
Angry developer
Angry developer
Avatar
Kevsoft M
Angry developer
Angry developer
Age: 24
Reputation: 93
Posts: 379
Joined: 26 Apr 2014
Location: Austria
Website

Post #6by Kevsoft » 16 Mar 2015, 11:03

Sambo wrote:Thanks. :) What did you do to figure that out? I think it could be useful to know.
Cheat Engine. Finding the address by searching between 0 and -1 and then use write trace for this address.

Sambo wrote:Is there a way to tell the direction in which the screen has split?
Did not find anything about that yet.

Sambo wrote:Is it possible to load an image only on player 1's screen or on player 2's screen and not both?
I didn't look into that, because I mainly designed LunaLua for single player.
▬▬▬▬▬▬▬▬▬▬ஜ۩۞۩ஜ▬▬▬▬▬▬▬▬ Signature.start() ▬▬▬▬▬▬▬▬▬▬ஜ۩۞۩ஜ▬▬▬▬▬▬▬
▬▬▬▬▬▬▬▬▬▬ஜ۩۞۩ஜ▬▬▬▬▬▬▬▬ Signature.end() ▬▬▬▬▬▬▬▬▬▬ஜ۩۞۩ஜ▬▬▬▬▬▬▬▬

Sambo M
Topic author, Count
Count
Avatar
Sambo M
Topic author, Count
Count
Age: 25
Reputation: 15
Posts: 264
Joined: 27 Jun 2014

Post #7by Sambo » 19 Mar 2015, 2:58

Kevsoft wrote:Cheat Engine. Finding the address by searching between 0 and -1 and then use write trace for this address.
I was going to try to do that, but I didn't know exactly what values I was looking for.

Did not find anything about that yet.
The size of each player's screen is different depending on the way it splits. Perhaps it would be possible to find the address of screen size, and determine split direction through that.
EDIT: Found addresses for screen size:

Code: Select all

screen_width = mem(0x00d451f8, FIELD_DWORD)
screen_height = mem(0x00d45200, FIELD_DWORD)
if screen_width == 400 then
  split_dir = "Vertical"
end
if screen_height == 300 then
  split_dir = "Horizontal"
end



I didn't look into that, because I mainly designed LunaLua for single player.
You should add that, because it would be useful and it would encourage people to continue making 2-player compatible games. I haven't seen many episodes that work well with 2 players lately.
Image
Current Project:
Image

Sambo M
Topic author, Count
Count
Avatar
Sambo M
Topic author, Count
Count
Age: 25
Reputation: 15
Posts: 264
Joined: 27 Jun 2014

Post #8by Sambo » 15 Apr 2015, 5:07

I have encountered a problem. It seems that the screen dimensions are not stored in the same memory addresses every time the program runs. :comando: Is there a way around this issue?
Image
Current Project:
Image


Return to “LunaLua - Extension Framework”

Who is online (over the past 5 minutes)

Users browsing this forum: 1 guest