English Amiga Board


Go Back   English Amiga Board > Support > support.WinUAE

 
 
Thread Tools
Old 20 October 2022, 01:47   #21
sonninnos
Commodork
 
sonninnos's Avatar
 
Join Date: Nov 2018
Location: Finland
Posts: 82
I found the missing piece that was preventing the updated CHD code from working as it should. Sadly it is a rather nasty hack, but Toni will surely shed some light on it.

All I did was copypaste all new code related to pregap and `read_partial_sector()` (the added last parameter `phys`). That sorted out the problem with PREGAP tracks. But I also had to force `phys` to false at a certain point to make it work with the INDEX00/01 tracks.

It appears that `phys` is supposed to be true in `cdrom_read_data()` only when using chdman, and it indeed is false by default in MAME machines. However WinUAE sets it true in `do_read()` in `blkdev_cdimage`. If I set it false there, all audio tracks will have even bigger start silences as before. But when it is set false only inside `read_partial_sector()` before the new code block which is commented as
Code:
// chdman (phys=true) relies on chdframeofs to point to index 0 instead of index 1 for extractcd.
// Actually playing CDs requires it to point to index 1 instead of index 0, so adjust the offset when phys=false.
it seems to work as it should..

Also this is not related to that earlier mentioned thing that pushes the track start offset further off the more there are tracks, as in the new code did not remove the need of that hack.

Last edited by sonninnos; 20 October 2022 at 01:52. Reason: cleanup
sonninnos is offline  
Old 20 October 2022, 10:28   #22
liveevil
Custom User Title
 
Join Date: Jan 2008
Location: UK
Posts: 331
Thanks sonninnos ! You're awesome. You're going from strength to strength. I use Retroarch PUAE more for it's portability and ease of use. I don't think the other guys were on the same page so to speak as they kept going on about the buzzing noise in Battle Chess which was found out to be from using Redump sets in post 8.
liveevil is offline  
Old 20 October 2022, 16:46   #23
Toni Wilen
WinUAE developer
 
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 49
Posts: 26,505
More examples please. Battle Chess isn't that clear example.. (One tutorial sentence seems to start 0.5s late or something.. Quite boring tutorial too..)
Toni Wilen is offline  
Old 20 October 2022, 17:21   #24
liveevil
Custom User Title
 
Join Date: Jan 2008
Location: UK
Posts: 331
@Toni

I uploaded the Battle Chess audio tracks in a CHD (MEGA link on the other page). It should boot straight to the CD32 CD Player. Every audio track misses the first second or two.

Another example is the Intro to 'The Clue'. The speech is missing the first part of every sentence.
liveevil is offline  
Old 20 October 2022, 17:50   #25
Toni Wilen
WinUAE developer
 
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 49
Posts: 26,505
I did say Battle Chess is not a good test case. Problem needs to happen immediately and be very clear.

Also as usual: full official file name must be included (and in which collection it is from) because there can be multiple variants.
Toni Wilen is offline  
Old 20 October 2022, 18:04   #26
liveevil
Custom User Title
 
Join Date: Jan 2008
Location: UK
Posts: 331
The Battle Chess I uploaded is just the audio tracks to play on the CD32 CD Player (I edited the .cue to skip the data track). When playing the tracks you can clearly hear a few second silence before they start playing.

TOSEC
Clue!, The (1994)(Kompart)[!]
liveevil is offline  
Old 20 October 2022, 20:34   #27
Toni Wilen
WinUAE developer
 
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 49
Posts: 26,505
Quote:
Originally Posted by liveevil View Post
TOSEC
Clue!, The (1994)(Kompart)[!]
But that is cue+iso+wav..
Toni Wilen is offline  
Old 20 October 2022, 21:01   #28
liveevil
Custom User Title
 
Join Date: Jan 2008
Location: UK
Posts: 331
CHDMAN converts CUE+ISO fine. I also converted it to CUE+BIN with PowerISO before converting to CHD and it still gives the same result. Intro speech doesn't play the first part of each sentence and sometimes nothing at all. I compared it with uncompressed CUE+BIN.

Last edited by liveevil; 20 October 2022 at 21:19.
liveevil is offline  
Old 21 October 2022, 00:48   #29
sonninnos
Commodork
 
sonninnos's Avatar
 
Join Date: Nov 2018
Location: Finland
Posts: 82
Brian the Lion seems to be a decent problem and test case, since it has both types of pregaps (first audio track has PREGAP and it starts at once, and rest have INDEX 01 and include 2sec start silence), and it starts playing many different tracks right off the bat by simply starting the game.

Problem is that the first title track starts too late even with raw image, and of course with the old and current MAME CHD code all start at the wrong place.. aargh.

And GenesisPlusGX plays the tracks like one would expect as both raw and CHD.
sonninnos is offline  
Old 21 October 2022, 12:01   #30
Toni Wilen
WinUAE developer
 
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 49
Posts: 26,505
I am too confused now. Topic says CHD, most posts talk about CHD including CHD parser code "phys" parameter.

But then suddenly topic seems to have changed to cue+bin.. Having some "broken" CHD converted to cue/bin won't help fixing it.

No TOSEC ISO nor Redump have CHD images. I am not going to convert anything (-> too many unknown variables). I need a) CHD that is known working in other emulators (For example when playing CD audio tracks) but not in WinUAE + b) exact same CHD in cue/bin or cue+iso+wav format that works. (=can see exactly the numeric difference in track starts/pregap/indexes. I am not going to randomly change "phys" values until something appears to change). It does not need to be Amiga CD. Some small demo audio CD is ok. Only requirement is that CHD converted variant is wrong and has identical gap size problem.
Toni Wilen is offline  
Old 21 October 2022, 23:42   #31
liveevil
Custom User Title
 
Join Date: Jan 2008
Location: UK
Posts: 331
Link to CHD's converted using CHDMAN -

https://mega.nz/folder/qk4z1KaI#-HhBOfWbdFRehr-YxNuUjA

Sources used -

/TOSEC-ISO/CD32/Commodore Amiga CD32 - Games - [ISO]/Clue!, The (1994)(Kompart)[!].zip
/TOSEC-ISO/CDTV/Commodore Amiga CDTV - Games - [BIN]/Xenon 2 - Megablast (1992)(Mirrorsoft)(M5)[CDTV-CD32].zip

Xenon 2 - Select the music icon and you can listen to each music track. There is a click at the beginning of track 1 and a few seconds of silence at the beginning of every track.

The Clue - The speech during the intro is missing a few seconds from every sentence.
liveevil is offline  
Old 22 October 2022, 12:17   #32
Toni Wilen
WinUAE developer
 
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 49
Posts: 26,505
Does https://www.winuae.net/files/b/winuae.7z fix it? (at least Clue! TOC log output now matches TOSEC version)

Only changes were merge of "phys" parameter update (chdcdrom.cpp, didn't bother with other updates, too many not UAE relevant changes) and use of logframeofs in place of physframeofs (blkdev_cdimage.cpp)
Toni Wilen is offline  
Old 22 October 2022, 13:38   #33
liveevil
Custom User Title
 
Join Date: Jan 2008
Location: UK
Posts: 331
It seems a lot better.

There still seems to be a pause before tracks. This puts the 'Chaos Engine' Intro audio out of sync with the video, where he names the mercenaries the name he says is not for the right picture that's showing. I imagine all Games audio tracks are delayed playing.

Still about 2 second pause before playing the audio tracks in 'Xenon 2'

In 'The Clue' intro the speech now plays correctly but when the woman's text says "Inspector, take that hankey" it doesn't play the audio in the CHD or the CUE+ISO+WAV (it's Track 12).

@sonninos
How does this compare to the changes you made to PUAE ?
liveevil is offline  
Old 22 October 2022, 14:55   #34
Toni Wilen
WinUAE developer
 
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 49
Posts: 26,505
The real question is: does CHDs now work exactly same as non-CHD of same game? Mixing different problems is confusing.
Toni Wilen is offline  
Old 22 October 2022, 15:05   #35
amilo3438
Amiga 500 User
 
Join Date: Jun 2013
Location: EU
Posts: 1,502
@liveevil

If I were you I would try to find the WinUAE version where the problem appears first. (if it ever worked as expected)

@Toni

I have tested a little the latest winuae.7z and seems the problems I had reported earlier is gone now. (except one, but more on that later)
If I can notice that the new IPL has already been installed.
amilo3438 is offline  
Old 22 October 2022, 15:11   #36
liveevil
Custom User Title
 
Join Date: Jan 2008
Location: UK
Posts: 331
Quote:
Originally Posted by Toni Wilen View Post
The real question is: does CHDs now work exactly same as non-CHD of same game? Mixing different problems is confusing.
No. For example, the CHD of Xenon 2 audio tracks have about 2 second silence at the beginning. When booting the original CUE+BIN there is no silence at the beginning. The tracks start instantly.

Chaos Engine CUE+ISO+WAV is in sync with the video intro. The CHD is out of sync (again, probably 2 seconds).
liveevil is offline  
Old 17 November 2022, 08:45   #37
sonninnos
Commodork
 
sonninnos's Avatar
 
Join Date: Nov 2018
Location: Finland
Posts: 82
Sorry for the long delay, I was busy with other things.

I managed to come up with an extremely simple change which fixed the various pregaps and allowed me to remove the hack required for the tracks getting gradually off starting point (best example Pinball Illusions), and all CHDs I've tested so far play exactly like the raw image.

So in addition to those MAME CHD updates, I did this to `blkdev_cdimage`:
Code:
@@ -190,7 +190,7 @@ static int do_read (struct cdunit *cdu, struct cdtoc *t, uae_u8 *data, int secto
                }
                if (audio && size == 2352)
                        type = CD_TRACK_AUDIO;
-               if (cdrom_read_data(cdu->chd_cdf, sector + t->offset, tmpbuf, type, true)) {
+               if (cdrom_read_data(cdu->chd_cdf, sector + t->offset, tmpbuf, type, false)) {
                        memcpy(data, tmpbuf + offset, size);
                        return 1;
                }
@@ -1524,8 +1524,8 @@ static int parsechd (struct cdunit *cdu, struct zfile *zcue, const TCHAR *img, c
                int size;
                const cdrom_track_info *strack = &stoc->tracks[i];
                struct cdtoc *dtrack = &cdu->toc[i];
-               dtrack->address = strack->physframeofs;
-               dtrack->offset = strack->chdframeofs;
+               dtrack->address = strack->logframeofs;
+               dtrack->offset = strack->logframeofs;
                dtrack->adr = cdrom_get_adr_control (cdf, i) >> 4;
                dtrack->ctrl = cdrom_get_adr_control (cdf, i) & 15;
                switch (strack->trktype)
As in changed `phys` to false like MAME says it should be, and replaced offset from `chdframeofs` to `logframeofs`.

PUAE core is updated already, so please test after the new version is available!
sonninnos is offline  
Old 26 November 2022, 11:27   #38
Toni Wilen
WinUAE developer
 
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 49
Posts: 26,505
Thanks. This fix looks correct (always use logical mode)
Toni Wilen is offline  
Old 30 January 2023, 22:11   #39
sonninnos
Commodork
 
sonninnos's Avatar
 
Join Date: Nov 2018
Location: Finland
Posts: 82
I discovered one more semi-important thing, but it involves adding the missing part to MAME code. It will allow playing the Cannon Fodder CD32 FMV intro when the image is in CHD form.

Code:
@@ -2785,6 +2785,12 @@ UINT32 cdrom_read_data(cdrom_file *file, UINT32 lbasector, void *buffer, UINT32
                        return (read_partial_sector(file, buffer, lbasector, chdsector, tracknum, 16, 2336, phys) == CHDERR_NONE);
                }

+               /* return 2352 byte mode 1 raw sector from a 2352 byte mode 2 raw sector */
+               if ((datatype == CD_TRACK_MODE1_RAW) && (tracktype == CD_TRACK_MODE2_RAW))
+               {
+                       return (read_partial_sector(file, buffer, lbasector, chdsector, tracknum, 0, 2352, phys) == CHDERR_NONE);
+               }
+
                write_log("CDROM: Conversion from type %d to type %d not supported!\n", tracktype, datatype);
                return 0;
        }
sonninnos is offline  
 


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Similar Threads
Thread Thread Starter Forum Replies Last Post
CHD format Ian project.TOSEC (amiga only) 32 31 July 2020 08:04
Make HDF (or other format) image of real Amiga CompactFlash HD? ProdigalAmigan support.Other 2 23 July 2019 19:48
Amiga titles that would make good boardgames pubzombie Retrogaming General Discussion 17 29 January 2012 21:45
Hello good people! MaximumRD Member Introductions 10 26 June 2010 15:51
People like this make me MAD ChrisBrownUK MarketPlace 6 30 October 2005 07:59

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 09:50.

Top

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Page generated in 0.58210 seconds with 15 queries