module Fux2
GM = Win32API.new('kernel32','GetModuleHandle','p','l')
PSP = Win32API.new('kernel32','RtlMoveMemory','pll','v')
PPSP = Win32API.new('kernel32','RtlMoveMemory','ppl','v')
U2S = Win32API.new('kernel32', 'WideCharToMultiByte', 'ilpipipp', 'i')
STOP_SE = Win32API.new('RGSS300','RGSSGetInt','v','v')
BASE_ADDR = GM.call("RGSS300.dll")
buf = "\0"*4
PSP.call(buf,BASE_ADDR + 0x25EB04,4)
SE_LIST_ADDR = buf.unpack("L")[0]+0x14
SE_STOP_CALL_ADDR = 0x1171C3
CODE_ADDR = BASE_ADDR+0x37A0
CODE = [0x55].pack("C*")
CODE += [0x8B,0xEC].pack("C*")
CODE += [0xB9,0,0,0,0].pack("C*")
CODE += [0xE8].pack("C")+[SE_STOP_CALL_ADDR].pack("L")
CODE += [0x33,0xC0,0x8B,0xE5,0x5D,0xC3].pack("C*")
PPSP.call(CODE_ADDR,CODE,CODE.size)
def self.set_addr(num)
tn = [num].pack("L")
PPSP.call(CODE_ADDR+4,tn,4)
end
def self.stop_se(filename=nil)
unless filename
Audio.se_stop
return false
end
buf = "\0"*4
(0...32).each do |i|
PSP.call(buf,SE_LIST_ADDR+i*4,4)
p_this_se = buf.unpack("L")[0]
p_this_se_name = p_this_se+0x70
namebuf = "\0"*0x220
PSP.call(namebuf,p_this_se_name,0x220)
p_this_se_name = "\0"*220
if U2S.call(0,0,namebuf,-1,p_this_se_name,0x110,nil,nil)>0
p_this_se_name = p_this_se_name.unpack("A*")[0]
if p_this_se_name==filename
set_addr(p_this_se)
STOP_SE.call
end
end
end
return true
end
end
#Audio.se_play("Audio/SE/ui_unique_get.wav")
#Fux2.stop_se("Audio/SE/ui_unique_get.wav")
module Fux2
GM = Win32API.new('kernel32','GetModuleHandle','p','l')
PSP = Win32API.new('kernel32','RtlMoveMemory','pll','v')
PPSP = Win32API.new('kernel32','RtlMoveMemory','ppl','v')
U2S = Win32API.new('kernel32', 'WideCharToMultiByte', 'ilpipipp', 'i')
STOP_SE = Win32API.new('RGSS300','RGSSGetInt','v','v')
BASE_ADDR = GM.call("RGSS300.dll")
buf = "\0"*4
PSP.call(buf,BASE_ADDR + 0x25EB04,4)
SE_LIST_ADDR = buf.unpack("L")[0]+0x14
SE_STOP_CALL_ADDR = 0x1171C3
CODE_ADDR = BASE_ADDR+0x37A0
CODE = [0x55].pack("C*")
CODE += [0x8B,0xEC].pack("C*")
CODE += [0xB9,0,0,0,0].pack("C*")
CODE += [0xE8].pack("C")+[SE_STOP_CALL_ADDR].pack("L")
CODE += [0x33,0xC0,0x8B,0xE5,0x5D,0xC3].pack("C*")
PPSP.call(CODE_ADDR,CODE,CODE.size)
def self.set_addr(num)
tn = [num].pack("L")
PPSP.call(CODE_ADDR+4,tn,4)
end
def self.stop_se(filename=nil)
unless filename
Audio.se_stop
return false
end
buf = "\0"*4
(0...32).each do |i|
PSP.call(buf,SE_LIST_ADDR+i*4,4)
p_this_se = buf.unpack("L")[0]
p_this_se_name = p_this_se+0x70
namebuf = "\0"*0x220
PSP.call(namebuf,p_this_se_name,0x220)
p_this_se_name = "\0"*220
if U2S.call(0,0,namebuf,-1,p_this_se_name,0x110,nil,nil)>0
p_this_se_name = p_this_se_name.unpack("A*")[0]
if p_this_se_name==filename
set_addr(p_this_se)
STOP_SE.call
end
end
end
return true
end
end
#Audio.se_play("Audio/SE/ui_unique_get.wav")
#Fux2.stop_se("Audio/SE/ui_unique_get.wav")