pcsx2 icon indicating copy to clipboard operation
pcsx2 copied to clipboard

Change lba to lsn

Open weirdbeardgame opened this issue 2 years ago • 3 comments

Description of Changes

Changed names of functions referring to CDVD LBA (Logical Block Address) to instead refer to the more correct term LSN (Logical sector number)

Rationale behind Changes

Several functions already had lsn in the title where other's did not. This fixes a naming convention that did not match and thus unifies the code base a bit more

Suggested Testing Steps

C if CI goes brrr

weirdbeardgame avatar Sep 17 '22 19:09 weirdbeardgame

Can you fix your commit name? Thanks.

refractionpcsx2 avatar Sep 17 '22 19:09 refractionpcsx2

That good?

weirdbeardgame avatar Sep 17 '22 20:09 weirdbeardgame

better yeah

refractionpcsx2 avatar Sep 17 '22 20:09 refractionpcsx2

In this line 96 of CDVDdiscReader.cpp you're renaming start_lba to start_lsn and assigning it to entry.lba. I would be a little careful with this change. I remember running into this when I worked on merging the cdvd plugin into the core.

According to the specs (MMC or MultiMedia Command Set) LBA and LSN are synonymous. However in libcdio it's defined as LSN = LBA - PREGAP_SECTORS where PREGAP_SECTORS = 150.

In master 150 is added to convert from LBA and LSN to MSF. At the time I was working on this, I was very confused whether or not gigaherz was using libcdio's definition of LBA vs LSN. Looking at the code now, I think LBA and LSN are used interchangeably throughout the code..

I recommend double checking if this is true and if it is we should rename all references from LSN to use LBA since that is the more common name. If LBA and LSN are used differently in the code, then this PR would be making the code misleading.

Sorry to be a pedant but seeing this PR come through I thought we might as well squash this issue now and avoid confusion in the future.

MonJamp avatar Oct 18 '22 04:10 MonJamp

You're not being pendant at all. According to my understanding, it seems like they're used interchangeably as the math seems almost exactly the same in both instances. As for LSN vs LBA, I don't really have a preference I just used LSN since that would seem more fitting for DVD's (Sectors on a DVD vs Blocks) but if we want LBA to be the used term that's just fine as well

weirdbeardgame avatar Oct 18 '22 04:10 weirdbeardgame

I guess LBA vs LSN doesn't matter, I initially mentioned to change it to LBA since it was easier to google for 😛. Since you already renamed it to LSN with this PR, renaming the remaining local variables, parameters, and class members from LBA to LSN will help clear up the code.

MonJamp avatar Oct 18 '22 17:10 MonJamp

Superceded by unifiedCdvd which doesn't rename anything yet, but might later

weirdbeardgame avatar Oct 25 '22 19:10 weirdbeardgame