Skip to content

Commit

Permalink
fx
Browse files Browse the repository at this point in the history
  • Loading branch information
weihuoya committed Jul 23, 2021
1 parent 02205ce commit 70c6711
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,9 @@ public final class EmulationActivity extends AppCompatActivity {
private class InitTask extends AsyncTask<Context, Void, Map<Integer, Bitmap>> {
@Override
protected Map<Integer, Bitmap> doInBackground(Context... contexts) {
if (!DirectoryInitialization.isInitialized()) {
DirectoryInitialization.start(contexts[0]);
}
Settings settings = new Settings();
settings.loadSettings(mGameId);
SettingSection section = settings.getSection(Settings.SECTION_INI_CORE);
Expand Down
19 changes: 11 additions & 8 deletions src/core/core.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -147,26 +147,29 @@ static void LoadOverrides(u64 title_id) {
// Shovel Knight
Settings::values.stream_buffer_hack = false;
} else if (title_id == 0x000400000008FE00) {
// 1001 Spikes [USA]
// 1001 Spikes
Settings::values.stream_buffer_hack = false;
Settings::SetFMVHack(!Settings::values.core_downcount_hack);
} else if (title_id == 0x0004000000049100 || title_id == 0x0004000000030400 ||
title_id == 0x0004000000049000) {
// Star Fox 64
Settings::values.disable_clip_coef = true;
} else if (title_id == 0x0004000000187E00 || title_id == 0x0004000000169A00) {
// Picross 2
Settings::values.disable_clip_coef = true;
} else if (title_id == 0x00040000000DCA00) {
// Danball Senki W Chou Custom
Settings::values.y2r_perform_hack = true;
}

const std::array<u64, 7> cpu_limit_ids = {
0x000400000007C700, // Mario Tennis Open
0x000400000007C800, // Mario Tennis Open
0x0004000000064D00, // Mario Tennis Open
0x00040000000B9100, // Mario Tennis Open
0x00040000000DCD00, // Mario Golf: World Tour
0x00040000000A5300, // Mario Golf: World Tour
0x00040000000DCE00, // Mario Golf: World Tour
0x000400000007C700, // Mario Tennis Open
0x000400000007C800, // Mario Tennis Open
0x0004000000064D00, // Mario Tennis Open
0x00040000000B9100, // Mario Tennis Open
0x00040000000DCD00, // Mario Golf: World Tour
0x00040000000A5300, // Mario Golf: World Tour
0x00040000000DCE00, // Mario Golf: World Tour
};
for (auto id : cpu_limit_ids) {
if (title_id == id) {
Expand Down
16 changes: 5 additions & 11 deletions src/video_core/renderer_opengl/gl_rasterizer_cache.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,6 @@ static OGLFramebuffer g_draw_framebuffer;
const FormatTuple& GetFormatTuple(PixelFormat pixel_format) {
const SurfaceType type = SurfaceParams::GetFormatType(pixel_format);
if (type == SurfaceType::Color) {
ASSERT(static_cast<std::size_t>(pixel_format) < fb_format_tuples.size());
if (GLES) {
return fb_format_tuples_oes[static_cast<unsigned int>(pixel_format)];
}
Expand Down Expand Up @@ -928,17 +927,15 @@ Surface RasterizerCacheOpenGL::GetSurface(const SurfaceParams& params, ScaleMatc
// it to adjust our params
Surface expandable = FindMatch<MatchFlags::Expand | MatchFlags::Invalid>(
surface_cache, params, match_res_scale);
if (expandable != nullptr && expandable->res_scale > target_res_scale) {
if (expandable != nullptr) {
target_res_scale = expandable->res_scale;
}

// Keep res_scale when reinterpreting d24s8 -> rgba8
if (params.pixel_format == PixelFormat::RGBA8) {
} else if (params.pixel_format == PixelFormat::RGBA8) {
// Keep res_scale when reinterpreting d24s8 -> rgba8
SurfaceParams find_params = params;
find_params.pixel_format = PixelFormat::D24S8;
expandable = FindMatch<MatchFlags::Expand | MatchFlags::Invalid>(
surface_cache, find_params, match_res_scale);
if (expandable != nullptr && expandable->res_scale > target_res_scale) {
if (expandable != nullptr) {
target_res_scale = expandable->res_scale;
}
}
Expand Down Expand Up @@ -1548,10 +1545,7 @@ bool RasterizerCacheOpenGL::NoUnimplementedReinterpretations(const Surface& surf
const SurfaceInterval& interval) {
static constexpr std::array<PixelFormat, 17> all_formats{
PixelFormat::RGBA8, PixelFormat::RGB8, PixelFormat::RGB5A1, PixelFormat::RGB565,
PixelFormat::RGBA4, PixelFormat::IA8, PixelFormat::RG8, PixelFormat::I8,
PixelFormat::A8, PixelFormat::IA4, PixelFormat::I4, PixelFormat::A4,
PixelFormat::ETC1, PixelFormat::ETC1A4, PixelFormat::D16, PixelFormat::D24,
PixelFormat::D24S8,
PixelFormat::RGBA4, PixelFormat::D16, PixelFormat::D24, PixelFormat::D24S8,
};
bool implemented = true;
for (PixelFormat format : all_formats) {
Expand Down
11 changes: 7 additions & 4 deletions src/video_core/renderer_opengl/gl_shader_gen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1885,10 +1885,13 @@ struct Vertex {
semantic(VSOutputAttributes::POSITION_Z) + ", " +
semantic(VSOutputAttributes::POSITION_W) + ");\n";
out += " gl_Position = vtx_pos;\n";
out += "#if !defined(CITRA_GLES) || defined(GL_EXT_clip_cull_distance)\n";
out += " gl_ClipDistance[0] = -vtx_pos.z;\n"; // fixed PICA clipping plane z <= 0
out += " gl_ClipDistance[1] = dot(clip_coef, vtx_pos);\n";
out += "#endif // !defined(CITRA_GLES) || defined(GL_EXT_clip_cull_distance)\n\n";

if (!Settings::values.disable_clip_coef) {
out += "#if !defined(CITRA_GLES) || defined(GL_EXT_clip_cull_distance)\n";
out += " gl_ClipDistance[0] = -vtx_pos.z;\n"; // fixed PICA clipping plane z <= 0
out += " gl_ClipDistance[1] = dot(clip_coef, vtx_pos);\n";
out += "#endif // !defined(CITRA_GLES) || defined(GL_EXT_clip_cull_distance)\n\n";
}

out += " vec4 vtx_quat = GetVertexQuaternion(vtx);\n";
out += " normquat = mix(vtx_quat, -vtx_quat, bvec4(quats_opposite));\n\n";
Expand Down

0 comments on commit 70c6711

Please sign in to comment.