Skip to content

Commit 784de24

Browse files
committed
When using emulator that is not default (dkwolf):
- Check plugin exists before launching - Fix playback problem "Extreme Galakong" improvements Update to about folder artwork
1 parent 08ff121 commit 784de24

File tree

9 files changed

+65
-20
lines changed

9 files changed

+65
-20
lines changed

Diff for: artwork/about/frontend.png

-199 Bytes
Loading

Diff for: artwork/about/gameinfo.png

289 Bytes
Loading

Diff for: artwork/about/launchmenu.png

-257 Bytes
Loading

Diff for: artwork/about/patches.png

336 Bytes
Loading

Diff for: artwork/about/slots.png

-310 Bytes
Loading

Diff for: dk_config.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -156,11 +156,11 @@
156156
COACH_FRIENDLY = ["dkongspringy", "dkongbarrels", "dkongcb", "dkonghrd"]
157157
CHORUS_FRIENDLY = ["dkongspringy", "dkongbarrels", "dkongcb", "dkonghrd", "dkongrivets", "dkongrnd",
158158
"dkongwbh", "dkongpies", "dkongjapan", "dkongpe", "dkongfr", "dkongl05", "dkongce", "dkongrev"]
159-
SHOOT_FRIENDLY = ["dkongspringy", "dkongbarrels", "dkongpies", "dkongrivets", "dkongpac", "dkongwbh"]
159+
SHOOT_FRIENDLY = ["dkongspringy", "dkongbarrels", "dkongpies", "dkongrivets", "dkongpac"]
160160
START5_FRIENDLY = ["dkongspringy", "dkongbarrels", "dkongpies", "dkongrivets", "dkongksfix"]
161161

162162
# Roms that don't support some DKAFE features fully
163-
HUD_UNFRIENDLY = ["dkongwizardry", "dkongduet"]
163+
HUD_UNFRIENDLY = ["dkongwizardry", "dkongduet", "dkongkonkey"]
164164
AUTOSTART_UNFRIENDLY = ["dkongbarpal", "dkongrndmzr"]
165165
AUTHOR_UNFRIENDLY = ["dkongwizardry", "dkongbarpal", "dkongrndmzr"]
166166

Diff for: dk_system.py

+14-5
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
from datetime import datetime
1414
from time import sleep, time
1515
from glob import glob
16-
from shutil import copy, move
16+
from shutil import copy, move, copytree
1717
os.environ['PYGAME_HIDE_SUPPORT_PROMPT'] = '1'
1818
from dk_config import *
1919
from dk_interface import lua_interface
@@ -95,16 +95,18 @@ def get_inp_dir(emu):
9595
return os.path.join(os.path.dirname(get_emulator(emu).split(" ")[0]), "inp")
9696

9797

98-
def get_inp_files(emu, name, sub, num):
98+
def get_inp_files(rec, name, sub, num):
9999
# Return the 5 most recent .inp recordings for the specified rom
100-
return sorted(glob(os.path.join(get_inp_dir(emu), f"{name}_{sub}_*.inp")), reverse=True)[:num]
100+
return sorted(glob(os.path.join(get_inp_dir(rec), f"{name}_{sub}_*.inp")), reverse=True)[:num]
101101

102102

103-
def build_launch_command(info, basic_mode=False, launch_plugin=None):
103+
def build_launch_command(info, basic_mode=False, launch_plugin=None, playback=False):
104104
# Receives subfolder (optional), name, emulator, unlock and target scores from info
105105
# If mame emulator supports a rompath (recommended) then the rom can be launched direct from the subfolder
106106
# otherwise the file will be copied over the main rom to avoid a CRC check fail. See ALLOW_ROM_OVERWRITE option.
107107
subfolder, name, emu, rec, unlock, score3, score2, score1 = info
108+
if playback: # playback using the original emulator/settings
109+
emu = rec
108110
emu_args = get_emulator(emu)
109111
inp_file = f"{name}_{subfolder}_{get_datetime()}_0m.inp"
110112
emu_args = emu_args.replace("<RECORD_ID>", inp_file)
@@ -130,7 +132,14 @@ def build_launch_command(info, basic_mode=False, launch_plugin=None):
130132
for plugin, plugin_folder in PLUGINS:
131133
if plugin == subfolder:
132134
launch_command += f" -plugin {plugin_folder}"
133-
break
135+
136+
if "dkwolf" not in launch_directory.lower():
137+
# Not using standard emulator so check the plugin path exists and copy if necessary
138+
plugin_target = os.path.join(launch_directory, "plugins", plugin_folder)
139+
if not os.path.exists(plugin_target):
140+
plugin_source = os.path.join(ROOT_DIR, "dkwolf", "plugins", plugin_folder)
141+
copytree(plugin_source, plugin_target)
142+
break
134143

135144
else:
136145
launch_command = launch_command.replace("<ROM_DIR>", ROM_DIR)

Diff for: dkwolf/plugins/galakong/init.lua

+47-10
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@
2121
-- SET GALAKONG_NOSTARS=1
2222
-- SET GALAKONG_NOEXPLOSIONS=1
2323
--
24+
-- The hack becomes "Extreme Galakong" when used in combination with the "Wild Barrel Hack" rom.
25+
--
2426
-- Minimum start up arguments:
2527
-- mame dkong -plugin galakong
2628
-----------------------------------------------------------------------------------------
@@ -60,6 +62,7 @@ function galakong.startplugin()
6062
local howhigh_ready = false
6163
local end_of_level = false
6264
local dead = false
65+
local extreme = false
6366
local name_entry = 0
6467

6568
local score = "000000"
@@ -177,6 +180,13 @@ function galakong.startplugin()
177180
" + +",
178181
" ++"}
179182

183+
local extreme_logo_table = {
184+
"!! ! ! !!! !! !! !!! !!",
185+
"! ! ! ! ! ! ! ! ! ! !",
186+
"!! ! ! !! !! ! ! ! !!",
187+
"! ! ! ! ! ! ! ! ! ! !",
188+
"!! ! ! ! ! ! !! ! ! ! !!"}
189+
180190
local explode1_table = {
181191
"",
182192
"",
@@ -326,9 +336,9 @@ function galakong.startplugin()
326336
-- Position of shield pickup by stage number
327337
local pickup_table = {}
328338
pickup_table[1] = {15, 212}
329-
pickup_table[2] = {8, 208}
339+
pickup_table[2] = {8, 161}
330340
pickup_table[3] = {121, 73}
331-
pickup_table[4] = {8, 192}
341+
pickup_table[4] = {8, 161}
332342

333343
-- Point scored for multiple missile hits and associated sprite display
334344
local bonus_table = {}
@@ -411,6 +421,12 @@ function galakong.startplugin()
411421
s_cpu = mac.devices[":soundcpu"]
412422
s_mem = s_cpu.spaces["data"]
413423

424+
-- Is this the wild barrel hack (i.e. extreme galakong)? Offset 3FBA to 3FBF is not used in regular DK
425+
if emu.romname() == "dkong" and mem:read_direct_u64(0x3fba) == 0x4d212153c31977dd then
426+
extreme = true
427+
pickup_table[1] = {10, 96} -- easier pickup location on barrels
428+
end
429+
414430
change_title()
415431

416432
--Generate a starfield
@@ -433,12 +449,7 @@ function galakong.startplugin()
433449

434450
--Add more delay to the GAME OVER screen
435451
mem:write_direct_u8(0x132f, 0xff)
436-
437-
-- Is this the wild barrel hack? Offset 3FBA to 3FBF is not used in regular DK
438-
if emu.romname() == "dkong" and mem:read_direct_u32(0x3fba) == 0xc31977dd and mem:read_direct_u16(0x3fbe) == 0x2153 then
439-
pickup_table[1] = {10, 5} -- make pickup location easier on barrels
440-
end
441-
452+
442453
-- Donkey Kong Junior specific initialisation
443454
if emu.romname() == "dkongjr" then
444455
enemy_table =
@@ -480,6 +491,24 @@ function galakong.startplugin()
480491
local left, right, fire
481492
local _frame = scr:frame_number()
482493

494+
if extreme then
495+
-- Adjust start level for extreme Galakong
496+
if level == 1 then
497+
mem:write_u8(0x6229, 5) -- update to level 5
498+
mem:write_u16(0x622a, 0x3a73) -- update screen sequence
499+
end
500+
-- Switch palette for extreme Galakong
501+
if stage == 1 then -- Girders
502+
mem:write_u8(0xc7d86, 1)
503+
mem:write_u8(0xc7d87, 0)
504+
elseif stage == 2 then -- Pies/Conveyors
505+
mem:write_u8(0xc7d86, 0)
506+
mem:write_u8(0xc7d87, 1)
507+
elseif stage == 4 then -- Rivets
508+
mem:write_u8(0xc7d86, 0)
509+
end
510+
end
511+
483512
if mode2 == 0x1 then -- Initial screen
484513
started = false
485514

@@ -499,6 +528,10 @@ function galakong.startplugin()
499528
draw_graphic(yard_logo_table, 19, 175)
500529
write_ram_message(0x77be, " VERSION "..exports.version)
501530

531+
if extreme then
532+
draw_graphic(extreme_logo_table, 224, 59)
533+
end
534+
502535
-- Alternative coin entry sound
503536
if mem:read_u8(0x6083) == 2 then
504537
clear_sounds()
@@ -576,7 +609,7 @@ function galakong.startplugin()
576609
if mode2 >= 0xb and mode2 <= 0xd then -- during gameplay
577610
jumpman_x = mem:read_u8(0x6203) - 15
578611
jumpman_y = mem:read_u8(0x6205)
579-
612+
580613
if pickup then
581614
-- shield was collected, the ship can now be controlled
582615
left, right, fire = get_inputs()
@@ -1048,7 +1081,11 @@ function galakong.startplugin()
10481081
-- change "HIGH SCORE" to "DK SHOOTER"
10491082
-- HIGH SCORE is 10 characters, pad with space if necessary
10501083
-- 1234567890
1051-
write_rom_message(0x36b4," GALAKONG ")
1084+
if extreme then
1085+
write_rom_message(0x36b4,"X-GALAKONG")
1086+
else
1087+
write_rom_message(0x36b4," GALAKONG ")
1088+
end
10521089

10531090
-- Change "HOW HIGH CAN YOU GET" text in rom to "HOW UP CAN YOU SCHMUP ?"
10541091
-- how high is 23 characters, pad with space if necessary

Diff for: launch.py

+2-3
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,6 @@ def check_for_input(force_exit=False):
237237

238238
# Optional joystick controls
239239
if USE_JOYSTICK:
240-
print(event.type)
241240
if event.type == pygame.JOYAXISMOTION:
242241
_g.active = True
243242
_g.lastmove = _g.timer.duration
@@ -531,7 +530,7 @@ def build_launch_menu():
531530
show_chorus = sub in CHORUS_FRIENDLY or (name == "dkong" and sub == "")
532531
show_start5 = sub in START5_FRIENDLY or (name == "dkong" and sub == "")
533532
show_shoot = sub in SHOOT_FRIENDLY
534-
inps = _s.get_inp_files(emu, name, sub, 12 - show_coach - show_chorus - show_shoot - show_start5)
533+
inps = _s.get_inp_files(rec, name, sub, 12 - show_coach - show_chorus - show_shoot - show_start5)
535534

536535
_g.launchmenu = pymenu.Menu(256, 224, _g.selected.center(26), mouse_visible=False, mouse_enabled=False,
537536
theme=dkafe_theme, onclose=close_menu)
@@ -735,7 +734,7 @@ def launch_rom(info, launch_plugin=None, override_emu=None):
735734

736735
def playback_rom(info, inpfile):
737736
"""playback the specified inp file"""
738-
launch_command, launch_directory, competing, _ = _s.build_launch_command(info, True, False)
737+
launch_command, launch_directory, competing, _ = _s.build_launch_command(info, True, False, True)
739738
if os.path.exists(launch_directory):
740739
close_menu()
741740
clear_screen(and_reset_display=True)

0 commit comments

Comments
 (0)