mirror of
https://github.com/Lime3DS/Lime3DS.git
synced 2024-11-30 13:24:16 +01:00
Merge pull request #5273 from xperia64/frame_timing_tweak
Update FPS to roughly match the actual 3DS rate
This commit is contained in:
commit
16913feb44
@ -11,10 +11,11 @@
|
|||||||
#include "core/core.h"
|
#include "core/core.h"
|
||||||
#include "core/core_timing.h"
|
#include "core/core_timing.h"
|
||||||
#include "core/hle/kernel/process.h"
|
#include "core/hle/kernel/process.h"
|
||||||
|
#include "core/hw/gpu.h"
|
||||||
|
|
||||||
namespace Cheats {
|
namespace Cheats {
|
||||||
|
|
||||||
constexpr u64 run_interval_ticks = BASE_CLOCK_RATE_ARM11 / 60;
|
constexpr u64 run_interval_ticks = GPU::frame_ticks;
|
||||||
|
|
||||||
CheatEngine::CheatEngine(Core::System& system_) : system(system_) {
|
CheatEngine::CheatEngine(Core::System& system_) : system(system_) {
|
||||||
LoadCheatFile();
|
LoadCheatFile();
|
||||||
|
@ -9,6 +9,7 @@
|
|||||||
#include "common/param_package.h"
|
#include "common/param_package.h"
|
||||||
#include "common/string_util.h"
|
#include "common/string_util.h"
|
||||||
#include "core/dumping/ffmpeg_backend.h"
|
#include "core/dumping/ffmpeg_backend.h"
|
||||||
|
#include "core/hw/gpu.h"
|
||||||
#include "core/settings.h"
|
#include "core/settings.h"
|
||||||
#include "video_core/renderer_base.h"
|
#include "video_core/renderer_base.h"
|
||||||
#include "video_core/video_core.h"
|
#include "video_core/video_core.h"
|
||||||
@ -124,8 +125,13 @@ bool FFmpegVideoStream::Init(FFmpegMuxer& muxer, const Layout::FramebufferLayout
|
|||||||
codec_context->bit_rate = Settings::values.video_bitrate;
|
codec_context->bit_rate = Settings::values.video_bitrate;
|
||||||
codec_context->width = layout.width;
|
codec_context->width = layout.width;
|
||||||
codec_context->height = layout.height;
|
codec_context->height = layout.height;
|
||||||
codec_context->time_base.num = 1;
|
// TODO(xperia64): While these numbers from core timing work fine, certain video codecs do not
|
||||||
codec_context->time_base.den = 60;
|
// support the strange resulting timebase (280071/16756991); Addressing this issue would require
|
||||||
|
// resampling the video
|
||||||
|
// List of codecs known broken by this change: mpeg1, mpeg2, mpeg4, libxvid
|
||||||
|
// See https://github.com/citra-emu/citra/pull/5273#issuecomment-643023325 for more information
|
||||||
|
codec_context->time_base.num = static_cast<int>(GPU::frame_ticks);
|
||||||
|
codec_context->time_base.den = static_cast<int>(BASE_CLOCK_RATE_ARM11);
|
||||||
codec_context->gop_size = 12;
|
codec_context->gop_size = 12;
|
||||||
codec_context->pix_fmt = codec->pix_fmts ? codec->pix_fmts[0] : AV_PIX_FMT_YUV420P;
|
codec_context->pix_fmt = codec->pix_fmts ? codec->pix_fmts[0] : AV_PIX_FMT_YUV420P;
|
||||||
if (format_context->oformat->flags & AVFMT_GLOBALHEADER)
|
if (format_context->oformat->flags & AVFMT_GLOBALHEADER)
|
||||||
|
@ -30,8 +30,6 @@ namespace GPU {
|
|||||||
Regs g_regs;
|
Regs g_regs;
|
||||||
Memory::MemorySystem* g_memory;
|
Memory::MemorySystem* g_memory;
|
||||||
|
|
||||||
/// 268MHz CPU clocks / 60Hz frames per second
|
|
||||||
const u64 frame_ticks = static_cast<u64>(BASE_CLOCK_RATE_ARM11 / SCREEN_REFRESH_RATE);
|
|
||||||
/// Event id for CoreTiming
|
/// Event id for CoreTiming
|
||||||
static Core::TimingEventType* vblank_event;
|
static Core::TimingEventType* vblank_event;
|
||||||
|
|
||||||
|
@ -12,6 +12,7 @@
|
|||||||
#include "common/bit_field.h"
|
#include "common/bit_field.h"
|
||||||
#include "common/common_funcs.h"
|
#include "common/common_funcs.h"
|
||||||
#include "common/common_types.h"
|
#include "common/common_types.h"
|
||||||
|
#include "core/core_timing.h"
|
||||||
|
|
||||||
namespace Memory {
|
namespace Memory {
|
||||||
class MemorySystem;
|
class MemorySystem;
|
||||||
@ -19,7 +20,12 @@ class MemorySystem;
|
|||||||
|
|
||||||
namespace GPU {
|
namespace GPU {
|
||||||
|
|
||||||
constexpr float SCREEN_REFRESH_RATE = 60;
|
// Measured on hardware to be 2240568 timer cycles or 4481136 ARM11 cycles
|
||||||
|
constexpr u64 frame_ticks = 4481136ull;
|
||||||
|
|
||||||
|
// Refresh rate defined by ratio of ARM11 frequency to ARM11 ticks per frame
|
||||||
|
// (268,111,856) / (4,481,136) = 59.83122493939037Hz
|
||||||
|
constexpr double SCREEN_REFRESH_RATE = BASE_CLOCK_RATE_ARM11 / static_cast<double>(frame_ticks);
|
||||||
|
|
||||||
// Returns index corresponding to the Regs member labeled by field_name
|
// Returns index corresponding to the Regs member labeled by field_name
|
||||||
#define GPU_REG_INDEX(field_name) (offsetof(GPU::Regs, field_name) / sizeof(u32))
|
#define GPU_REG_INDEX(field_name) (offsetof(GPU::Regs, field_name) / sizeof(u32))
|
||||||
|
Loading…
Reference in New Issue
Block a user