Skip to content

Commit

Permalink
Merge pull request #19121 from hrydgard/minor-fixes
Browse files Browse the repository at this point in the history
Fix Digimon audio along with some minor issues
  • Loading branch information
hrydgard committed May 10, 2024
2 parents 9d9c4e5 + 70ae4a3 commit a06b301
Show file tree
Hide file tree
Showing 7 changed files with 57 additions and 28 deletions.
5 changes: 3 additions & 2 deletions Core/HLE/sceAtrac.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -959,8 +959,9 @@ static int sceAtracLowLevelDecode(int atracID, u32 sourceAddr, u32 sourceBytesCo

int bytesConsumed = 0;
int outSamples = 0;
atrac->Decoder()->Decode(srcp, atrac->GetTrack().BytesPerFrame(), &bytesConsumed, 2, outp, &outSamples);
int bytesWritten = outSamples * 2 * sizeof(int16_t);
int channels = atrac->GetOutputChannels();
atrac->Decoder()->Decode(srcp, atrac->GetTrack().BytesPerFrame(), &bytesConsumed, channels, outp, &outSamples);
int bytesWritten = outSamples * channels * sizeof(int16_t);
*srcConsumed = bytesConsumed;
*outWritten = bytesWritten;

Expand Down
1 change: 1 addition & 0 deletions Core/MemMap.h
Original file line number Diff line number Diff line change
Expand Up @@ -337,6 +337,7 @@ inline u32 ValidSize(const u32 address, const u32 requested_size) {
return requested_size;
}

// NOTE: If size == 0, any address will be accepted. This may not be ideal for all cases.
inline bool IsValidRange(const u32 address, const u32 size) {
return ValidSize(address, size) == size;
}
Expand Down
7 changes: 4 additions & 3 deletions GPU/GPUCommon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1675,11 +1675,12 @@ void GPUCommon::DoBlockTransfer(u32 skipDrawReason) {
if ((dstBasePtr & 0x04800000) == 0x04800000)
dstBasePtr &= ~0x00800000;

// Use height less one to account for width, which can be greater or less than stride.
// Use height less one to account for width, which can be greater or less than stride, and then add it on for the last line.
// NOTE: The sizes are only used for validity checks and memory info tracking.
const uint32_t src = srcBasePtr + (srcY * srcStride + srcX) * bpp;
const uint32_t srcSize = (height - 1) * (srcStride + width) * bpp;
const uint32_t dst = dstBasePtr + (dstY * dstStride + dstX) * bpp;
const uint32_t dstSize = (height - 1) * (dstStride + width) * bpp;
const uint32_t srcSize = ((height - 1) * srcStride) + width * bpp;
const uint32_t dstSize = ((height - 1) * dstStride) + width * bpp;

bool srcDstOverlap = src + srcSize > dst && dst + dstSize > src;
bool srcValid = Memory::IsValidRange(src, srcSize);
Expand Down
39 changes: 23 additions & 16 deletions Tools/langtool/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 7 additions & 7 deletions Windows/MainWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1008,19 +1008,19 @@ namespace MainWindow
return DefWindowProc(hWnd, message, wParam, lParam);

HDROP hdrop = (HDROP)wParam;
int count = DragQueryFile(hdrop,0xFFFFFFFF,0,0);
int count = DragQueryFile(hdrop, 0xFFFFFFFF, 0, 0);
if (count != 1) {
MessageBox(hwndMain,L"You can only load one file at a time",L"Error",MB_ICONINFORMATION);
}
else
{
TCHAR filename[512];
if (DragQueryFile(hdrop, 0, filename, 512) != 0) {
// TODO: Translate? Or just not bother?
MessageBox(hwndMain, L"You can only load one file at a time", L"Error", MB_ICONINFORMATION);
} else {
TCHAR filename[1024];
if (DragQueryFile(hdrop, 0, filename, ARRAY_SIZE(filename)) != 0) {
const std::string utf8_filename = ReplaceAll(ConvertWStringToUTF8(filename), "\\", "/");
System_PostUIMessage(UIMessage::REQUEST_GAME_BOOT, utf8_filename);
Core_EnableStepping(false);
}
}
DragFinish(hdrop);
}
break;

Expand Down
9 changes: 9 additions & 0 deletions libretro/libretro.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -842,6 +842,15 @@ static void check_variables(CoreParameter &coreParam)
g_Config.iTexFiltering = 4;
}

var.key = "ppsspp_smart_2d_texture_filtering";
if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var) && var.value)
{
if (!strcmp(var.value, "disabled"))
g_Config.bSmart2DTexFiltering = false;
else
g_Config.bSmart2DTexFiltering = true;
}

var.key = "ppsspp_texture_replacement";
if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var) && var.value)
{
Expand Down
10 changes: 10 additions & 0 deletions libretro/libretro_core_options.h
Original file line number Diff line number Diff line change
Expand Up @@ -584,6 +584,16 @@ struct retro_core_option_v2_definition option_defs_us[] = {
},
"Auto"
},
{
"ppsspp_smart_2d_texture_filtering",
"Smart 2D Texture Filtering",
NULL,
"Gets rid of some visual artifacts caused by unnecessary texture filtering in some 2D games, by switching to nearest filtering.",
NULL,
"video",
BOOL_OPTIONS,
"disabled"
},
{
"ppsspp_texture_replacement",
"Texture Replacement",
Expand Down

0 comments on commit a06b301

Please sign in to comment.