|
Post by monstersgoboom on Dec 31, 2019 14:11:26 GMT
Hey there. I've just started playing with HuC, I have a pretty fun playable demo already. A glimpse can be seen here Anyway. Ihe HuC SDK examples,they don't have sound at all? The shmup sample looks to have code to play music and sfx but is silent ? What's the state of HuC 3.99 re audio ? The SDK seems to imply we can read more than one joystick but it doesn't seem to work? Does anyone have any ideas if it's supposed to or code to prove it does ? Entirely possible I messed up somehow Anyway thanks and Happy New Year Update Multiple pads is working.
|
|
Deleted
Deleted Member
Posts: 0
|
Post by Deleted on Dec 31, 2019 15:57:20 GMT
That's looking good, congrats!
I don't see why the controller code wouldn't work, but I don't mess with HuC much so I really can't say anything about it.
|
|
touko
Punkic Cyborg
Posts: 106
|
Post by touko on Dec 31, 2019 17:25:17 GMT
Same here, really good work .
This is strange, may be the latest version has a bug with pads . Lock'n chase, an homebrew developed with the huc 3.21 use up to four/five players, and the pads reading code works fine .
|
|
|
Post by monstersgoboom on Dec 31, 2019 17:26:52 GMT
That's looking good, congrats! I don't see why the controller code wouldn't work, but I don't mess with HuC much so I really can't say anything about it. Can you point me at an asm example for multiple controllers ?
|
|
|
Post by monstersgoboom on Dec 31, 2019 17:32:32 GMT
Same here, really good work . This is strange, may be the latest version has a bug with pads . Lock'n chase, an homebrew developed with the huc 3.21 use up to four/five players, and the pads reading code works fine . Ok I'll try rolling back to that see if it works thanks .
|
|
touko
Punkic Cyborg
Posts: 106
|
Post by touko on Dec 31, 2019 17:33:05 GMT
i looked at the both code for joypads (huc 3.21 and 3.99) and they are different .
Here the 3.21 version :
; ----
; read_joypad
; ----
; poll joypads
;
; 'joyport' (location $1000) is a control read/write port which only reads
; 4 bits at a time; the program uses joyport to toggle the multiplex line
;
; real logic values are read into the port - the joypad's keys are default
; high, and 'pulled' low when pressed. Therefore, these values must be
; inverted/complemented to yield values where '1' means 'pressed'
;
; bit values for joypad bytes: (MSB = #7; LSB = #0)
; -------------------------------------------------
; bit 0 (ie $01) = I
; bit 1 (ie $02) = II
; bit 2 (ie $04) = 'select'
; bit 3 (ie $08) = 'run'
; bit 4 (ie $10) = UP
; bit 5 (ie $20) = RIGHT
; bit 6 (ie $40) = DOWN
; bit 7 (ie $80) = LEFT
; ----
; bit values for joypad 6-button bytes: (MSB = #7; LSB = #0)
; ----------------------------------------------------------
; bit 0 (ie $01) = III
; bit 1 (ie $02) = IV
; bit 2 (ie $04) = V
; bit 3 (ie $08) = VI
; bit 4-7 (ie $F0) = exists (all on or all off)
; ----
; Note: Read twice for 6-button joysticks.
; First read should be for 'joy' and second for
; 'joy6'; need to hide values temporarily while
; scanning twice.
read_joypad:
maplibfunc lib2_readjoy
rts
.bank LIB2_BANK
lib2_readjoy:
lda joyena ; suppress reset during individual read
pha
stz joyena
.if (CDROM)
jsr ex_joysns
.else
jsr .readjoys
.endif
tii joy, joy6, 5 ; move to 6-button area
.if (CDROM)
jsr ex_joysns
.else
jsr .readjoys
.endif
pla
sta joyena
tii joytmp, joyold, 5 ; restore past info from stash
tii joytmp6, joyold6, 5
;
; the '.l2' loop determines if first or
; second scans imply a 6-button joystick,
; and rearrange bytes if out of order,
; and zero the joy6 area if necessary
;
cly
.l2: lda joy,Y ; check if 6-button joypad, and
tax
and #JOY_TYPE6 ; scans became backwards somehow
cmp #JOY_TYPE6
bne .notswap
lda joy6,Y ; then swap them if they need it
sta joy,Y
sax
sta joy6,Y
.notswap:
lda joy6,Y ; verify whether a 6-button exists
and #JOY_TYPE6
cmp #JOY_TYPE6
beq .type6
cla
sta joy6,Y ; not 6-button, so clear extra entry
.type6:
lda joy6,Y ; strip off unused bits
and #(JOY_III | JOY_IV | JOY_V | JOY_VI | JOY_TYPE6)
sta joy6,Y ; clear unnecessary bits
;
; The '.l2a' area sets appropriate values
; for all of the joytrg and joybuf areas
;
.l2a: lda joy,Y
eor joyold,Y ; check against previous value
and joy,Y
sta joytrg,Y ; 'new key pressed' key values
; ----
; buffered 'new key pressed'
; see joy_events();
;
ora joybuf,Y ; collect 'new key pressed'
sta joybuf,Y
; ----
; repeat the joyold/joytrg/joybuf stuff
; for 6-button values
;
lda joy6,Y
eor joyold6,Y
and joy6,Y
sta joytrg6,Y
ora joybuf6,Y
sta joybuf6,Y
; ----
; next joypad
;
iny
cpy #$05 ; cycle for next of 5 joypads
bcc .l2
; ----
; soft reset check
;
cly ; start cycle of 5 joypads
.l3: lda joyena ; find mask of 'important' joysticks
and .bitmsk,Y
beq .l4 ; not important enough to check
lda joytrg,Y
cmp #$04 ; 'select' key newly-pressed ?
bne .l4
lda joy,Y
cmp #$0C ; 'run+select' currently pressed ?
bne .l4
.if (DEVELO)
jmp _system
.else
jmp [soft_reset] ; run+select 'soft reset' vector
.endif ; (DEVELO)
.l4: iny ; try next joypad
cpy #$05
bcc .l3
; ----
; joyread hook
;
.ifdef HUC
tstw joyhook
beq .l5
jsr .hook
.l5:
.endif ; HUC
; ----
; return
;
tii joy, joytmp, 5 ; stash values for next read because CDROM
tii joy6, joytmp6, 5 ; may force another read between VSYNC's
rts
.if !(CDROM)
; ----
; read 5 joystick values into 'joy' buffer area
;
.readjoys:
tii joy, joyold, 5
lda #$01 ; reset joypad port to joystick #1
sta joyport
lda #$03
sta joyport
jsr .delay
cly ; counter for 5 joypads
.rdlp: lda #$01 ; first nybble
sta joyport
bsr .delay ; required delay (approx 9 cycles)
lda joyport ; fetch first nybble
asl A ; shift it to 'high' position within byte
asl A
asl A
asl A
sta joy,Y ; store in 'current' area
stz joyport ; toggle port (to read other 4 key values)
bsr .delay ; delay again
lda joyport ; fetch second nybble
and #$0F ; clear unused bits
ora joy,Y ; merge 2 nybbles into 1 byte
eor #$FF ; reset 'sense' of keys
sta joy,Y ; store it
iny
cpy #$05 ; cycle for next of 5 joypads
bcc .rdlp
rts
; ----
; small delay
;
.delay:
ldx #3
.l6: dex
bne .l6
rts
.endif ; !(CDROM)
.bitmsk:
.db $01,$02,$04,$08,$10 ; bit-masks for check-reset
; ----
; user routine
;
.ifdef HUC
.hook:
jmp [joyhook]
.endif ; HUC
; At end of all this lib2_bank stuff, we need to return
; to the base context of lib1_bank:
.bank LIB1_BANK
|
|
|
Post by DarkKobold on Dec 31, 2019 17:51:33 GMT
you absolutely can read from more than one pad - I'm currently using it in HuC. Let me know what problems you are having.
|
|
|
Post by monstersgoboom on Dec 31, 2019 18:04:19 GMT
Ok the Joystick issue is solved. It didn't work in turboengine for some reason. but works in mednafen now I've configured it.
|
|
|
Post by monstersgoboom on Dec 31, 2019 18:25:01 GMT
Now I still have the sound issue. it's not a mednafen issue as I can hear audio in other roms ? Anyone have a working example ?
|
|
|
Post by Arkhan on Dec 31, 2019 21:59:17 GMT
I wasn't aware that any other sound-things besides Squirrel were functional for both sound and music, but I've also not been paying attention for a few months.
What examples are you looking at?
|
|
|
Post by monstersgoboom on Dec 31, 2019 22:11:22 GMT
I wasn't aware that any other sound-things besides Squirrel were functional for both sound and music, but I've also not been paying attention for a few months. What examples are you looking at? The shmup sample looks like it's supposed to have audio using the simple tracker api and sound fx. If that isn't expected to work then it explains why it doesn't work for me .
|
|
|
Post by gredler on Dec 31, 2019 23:25:33 GMT
Welcome to the forums and great job on that work so far! We have also had difficulty with sound, and as Arkhan mentioned his squirrel toolset is the only publically available option, as far as I know know, for HuC audio. Although others have private solutions for both HuC and using the system's ASM accessible features. Here is the official link to his tool set which includes some links to tutorial videos and examples. www.aetherbyte.com/aetherbyte-squirrel_for_pc-engine_and_turbografx-16.htmlI had issues trying to get 3.99 and the current squirrel option to work together, but haven't had time to present the issue with proper documentation and troubleshooting steps. There are versions available of both 3.99 and squirrel which play nicely together, but I don't have them hosted or a easy bookmark to share the link here now. The versions have locally were shared with me by DarkKobold. Here are some relevant threads discussing the issues and hurdles: pcengine.proboards.com/thread/89/dumping-ground-links-pcefx-threadspcengine.proboards.com/thread/649/sound-thread-creating-pce-dummiesHave you tried compiling your game using 3.21, and or have you installed squirrel? I do not think there are any other C solutions, and I think the tutorials may expect you to have Squirrel setup alongside HuC though it may not explicitly say so.
|
|
|
Post by monstersgoboom on Jan 1, 2020 1:59:05 GMT
Welcome to the forums and great job on that work so far! We have also had difficulty with sound, and as Arkhan mentioned his squirrel toolset is the only publically available option, as far as I know know, for HuC audio. Although others have private solutions for both HuC and using the system's ASM accessible features. Here is the official link to his tool set which includes some links to tutorial videos and examples. www.aetherbyte.com/aetherbyte-squirrel_for_pc-engine_and_turbografx-16.htmlI had issues trying to get 3.99 and the current squirrel option to work together, but haven't had time to present the issue with proper documentation and troubleshooting steps. There are versions available of both 3.99 and squirrel which play nicely together, but I don't have them hosted or a easy bookmark to share the link here now. The versions have locally were shared with me by DarkKobold. Here are some relevant threads discussing the issues and hurdles: pcengine.proboards.com/thread/89/dumping-ground-links-pcefx-threadspcengine.proboards.com/thread/649/sound-thread-creating-pce-dummiesHave you tried compiling your game using 3.21, and or have you installed squirrel? I do not think there are any other C solutions, and I think the tutorials may expect you to have Squirrel setup alongside HuC though it may not explicitly say so. Thanks I'll look into 3.21 I saw there where issues with squirrel and 3.9x I will consider rolling back if I need to.
|
|
|
Post by elmer on Jan 1, 2020 3:51:23 GMT
The shmup sample looks like it's supposed to have audio using the simple tracker api and sound fx. If that isn't expected to work then it explains why it doesn't work for me . Nope, it was something that Uli started to add into his fork of HuC, and it was *barely* working when he abandoned the project. It wasn't left in a state where there was anything worth salvaging, so I ripped the guts out of it, and just left in enough to keep the examples compiling. Squirrel is your only current publicly-available option for playing music and sound effects from within HuC. The homebrew PCE CD games that I've seen just play back CD Audio, and then use the PSG (or ADPCM chip) for sound effects. Both Mooz and I have done work on converting Deflemask tunes to play back in a game-appropriate way, but AFAIK the results of neither of our projects are "public" at this point, although I did release some work-in-progress demos of my code a few years back (as part of Michirin9801's albums on bandcamp) ... pcengine.proboards.com/post/11496/threadI had issues trying to get 3.99 and the current squirrel option to work together, but haven't had time to present the issue with proper documentation and troubleshooting steps. There are versions available of both 3.99 and squirrel which play nicely together, but I don't have them hosted or a easy bookmark to share the link here now. The versions have locally were shared with me by DarkKobold . Jeez ... you were a part of the thread about this a few months ago, and everything was decided to be working fine, and confirmed by TheOldMan, A version of Squirrel that was compatible with the latest HuC was posted in that thread, together with another post that showed that one of the remaining problems in Squirrel was due to a typo that exists in *ALL* public version of Squirrel (including the one that was posted). pcengine.proboards.com/post/10902/threadpcengine.proboards.com/post/10949/threadIs there some newly-found problem that has not been reported?
|
|
|
Post by Arkhan on Jan 1, 2020 10:48:00 GMT
Nobody ever mentioned why/how that typo bug exists but never seemed to be a problem until post 3.21 releases of HuC, though. That whole thing is weird in general. If it was a glaring problem, it should have come up by now.
|
|