mirror of
https://github.com/holub/mame
synced 2025-04-19 15:11:37 +03:00
More reshuffling, nw
This commit is contained in:
parent
9a47a870df
commit
09f03905fd
98
bgfx/chains/test.json
Normal file
98
bgfx/chains/test.json
Normal file
@ -0,0 +1,98 @@
|
||||
{ "name": "Test Shader Chain"
|
||||
"author": "Ryan Holtz"
|
||||
"sliders": [
|
||||
{ "type": "bool", "name": "adjustments", "text": "Enable Adjustments", "default": false },
|
||||
{ "type": "float", "name": "ratio_amount", "text": "Ratio Amount", "default": 0, "max": 1 },
|
||||
|
||||
{ "type": "color", "name": "red_ratios", "text": "Red Amount", "default": [ 1, 0, 0 ]},
|
||||
{ "type": "color", "name": "grn_ratios", "text": "Green Amount", "default": [ 0, 1, 0 ], "max": 1, "min": 0 },
|
||||
{ "type": "color", "name": "blu_ratios", "text": "Blue Amount", "default": [ 0, 0, 1 ], "max": 1, "min": 0 },
|
||||
{ "type": "color", "name": "tint": "text": "Tint", "default": [ 1, 1, 1 ], "max": 1, "min": 0 }
|
||||
{ "type": "color", "name": "phosphor", "text": "Phosphor Amount", "default": [ 0, 0, 0 ], "max": 1, "min": 0 },
|
||||
{ "type": "vec2", "name": "shift", "text": "Frame Shift", "default": [ 0, 0 ], "max": 25, "min": -25 },
|
||||
]
|
||||
"parameters": [
|
||||
{ "name": "alternating", "type": "frame_mask", "period": 2 }
|
||||
]
|
||||
"targets": [
|
||||
{ "name": "native",
|
||||
"screen": true,
|
||||
},
|
||||
{ "name": "previous",
|
||||
"screen": true,
|
||||
"prescale": true
|
||||
}
|
||||
]
|
||||
"passes": [
|
||||
{ "effect": "ratios",
|
||||
"name": "Matrix Pass"
|
||||
"disable_conditions": [
|
||||
{ "type": "slider", "name": "adjustments", "value": false },
|
||||
{ "type": "slider", "name": "ratio_amount", "value": 0 }
|
||||
],
|
||||
"uniforms": [
|
||||
{ "name": "u_ratio_amount", "slider": "ratio_amount" },
|
||||
{ "name": "u_red_ratios", "slider": "red_ratios" },
|
||||
{ "name": "u_grn_ratios", "slider": "grn_ratios" },
|
||||
{ "name": "u_blu_ratios", "slider": "blu_ratios" }
|
||||
],
|
||||
"input": [
|
||||
{ "sampler": "s_tex", "texture": "screen" }
|
||||
],
|
||||
"output": "native"
|
||||
},
|
||||
{ "effect": "tint",
|
||||
"name": "Tint Pass"
|
||||
"disable_conditions": [
|
||||
{ "type": "slider", "name": "adjustments", "value": false }
|
||||
],
|
||||
"uniforms": [
|
||||
{ "name": "u_tint", "slider": "tint" },
|
||||
{ "name": "u_shift", "slider": "shift" }
|
||||
],
|
||||
"input": [
|
||||
{ "sampler": "s_tex", "texture": "native" }
|
||||
],
|
||||
"output": "native"
|
||||
},
|
||||
{ "effect": "phosphor"
|
||||
"name": "Phosphor Decay",
|
||||
"disable_conditions": [
|
||||
{ "type": "slider", "name": "adjustments", "value": false },
|
||||
{ "type": "slider", "name": "phosphor", "value": [ 0, 0, 0 ] }
|
||||
],
|
||||
"uniforms": [
|
||||
{ "name": "u_passthrough", "value": [ 0.0f ] },
|
||||
{ "name": "u_phosphor", "slider": "phosphor" }
|
||||
],
|
||||
"input": [
|
||||
{ "sampler": "s_tex", "texture": "native" },
|
||||
{ "sampler": "s_prev", "texture": "previous" }
|
||||
],
|
||||
"output": "native"
|
||||
},
|
||||
{ "effect": "phosphor"
|
||||
"name": "Phosphor Store",
|
||||
"disable_conditions": [
|
||||
{ "type": "slider", "name": "adjustments", "value": false },
|
||||
{ "type": "slider", "name": "phosphor", "value": [ 0, 0, 0 ] }
|
||||
],
|
||||
"uniforms": [
|
||||
{ "name": "u_passthrough", "value": [ 1.0f ] },
|
||||
{ "name": "u_phosphor", "slider": "phosphor" }
|
||||
],
|
||||
"input": [
|
||||
{ "sampler": "s_tex", "texture": "native" },
|
||||
{ "sampler": "s_prev", "texture": "native" }
|
||||
],
|
||||
"output": "previous"
|
||||
},
|
||||
{ "effect": "blit"
|
||||
"name": "Final Blit",
|
||||
"input": [
|
||||
{ "sampler": "s_tex", "texture": "native" }
|
||||
],
|
||||
"output": "backbuffer"
|
||||
}
|
||||
]
|
||||
}
|
@ -109,8 +109,9 @@ function osdmodulesbuild()
|
||||
MAME_DIR .. "src/osd/modules/render/bgfx/effect.cpp",
|
||||
MAME_DIR .. "src/osd/modules/render/bgfx/effectmanager.cpp",
|
||||
MAME_DIR .. "src/osd/modules/render/bgfx/effectreader.cpp",
|
||||
MAME_DIR .. "src/osd/modules/render/bgfx/pass.cpp",
|
||||
MAME_DIR .. "src/osd/modules/render/bgfx/passreader.cpp",
|
||||
MAME_DIR .. "src/osd/modules/render/bgfx/chainentry.cpp",
|
||||
MAME_DIR .. "src/osd/modules/render/bgfx/chainentryreader.cpp",
|
||||
MAME_DIR .. "src/osd/modules/render/bgfx/inputpair.cpp",
|
||||
MAME_DIR .. "src/osd/modules/render/bgfx/shadermanager.cpp",
|
||||
MAME_DIR .. "src/osd/modules/render/bgfx/statereader.cpp",
|
||||
MAME_DIR .. "src/osd/modules/render/bgfx/target.cpp",
|
||||
|
@ -10,6 +10,7 @@
|
||||
#define __OSDWINDOW__
|
||||
|
||||
#include "emu.h"
|
||||
#include "ui/ui.h"
|
||||
|
||||
//============================================================
|
||||
// TYPE DEFINITIONS
|
||||
@ -221,6 +222,7 @@ public:
|
||||
virtual int init(running_machine &machine) = 0;
|
||||
virtual render_primitive_list *get_primitives() = 0;
|
||||
|
||||
virtual slider_state* get_slider_list() { return nullptr; }
|
||||
virtual int draw(const int update) = 0;
|
||||
virtual int xy_to_render_target(const int x, const int y, int *xt, int *yt) { return 0; };
|
||||
virtual void save() { };
|
||||
|
33
src/osd/modules/render/bgfx/chainentry.cpp
Normal file
33
src/osd/modules/render/bgfx/chainentry.cpp
Normal file
@ -0,0 +1,33 @@
|
||||
#include "emu.h"
|
||||
|
||||
#include <bgfx/bgfx.h>
|
||||
|
||||
#include "effect.h"
|
||||
#include "texture.h"
|
||||
#include "target.h"
|
||||
#include "chainentry.h"
|
||||
|
||||
bgfx_chain_entry::bgfx_chain_entry(std::string name, bgfx_effect* effect, std::vector<bgfx_input_pair>& inputs, bgfx_target* output)
|
||||
: m_name(name)
|
||||
, m_effect(effect)
|
||||
, m_output(output)
|
||||
{
|
||||
for (bgfx_input_pair input : inputs)
|
||||
{
|
||||
m_inputs.push_back(input);
|
||||
}
|
||||
}
|
||||
|
||||
bgfx_chain_entry::~bgfx_chain_entry()
|
||||
{
|
||||
}
|
||||
|
||||
void bgfx_chain_entry::submit(render_primitive* prim, int view)
|
||||
{
|
||||
for (bgfx_input_pair input : m_inputs)
|
||||
{
|
||||
input.bind(m_effect);
|
||||
}
|
||||
bgfx::setViewFrameBuffer(view, m_output->target());
|
||||
m_effect->submit(view);
|
||||
}
|
34
src/osd/modules/render/bgfx/chainentry.h
Normal file
34
src/osd/modules/render/bgfx/chainentry.h
Normal file
@ -0,0 +1,34 @@
|
||||
#pragma once
|
||||
|
||||
#ifndef __DRAWBGFX_CHAIN_ENTRY__
|
||||
#define __DRAWBGFX_CHAIN_ENTRY__
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "inputpair.h"
|
||||
|
||||
class render_primitive;
|
||||
class bgfx_effect;
|
||||
class bgfx_texture;
|
||||
class bgfx_target;
|
||||
|
||||
class bgfx_chain_entry
|
||||
{
|
||||
public:
|
||||
bgfx_chain_entry(std::string name, bgfx_effect* effect, std::vector<bgfx_input_pair>& inputs, bgfx_target* output);
|
||||
~bgfx_chain_entry();
|
||||
|
||||
void submit(render_primitive* prim, int view);
|
||||
|
||||
// Getters
|
||||
std::string name() const { return m_name; }
|
||||
|
||||
private:
|
||||
std::string m_name;
|
||||
bgfx_effect* m_effect;
|
||||
std::vector<bgfx_input_pair> m_inputs;
|
||||
bgfx_target* m_output;
|
||||
};
|
||||
|
||||
#endif // __DRAWBGFX_CHAIN_ENTRY__
|
48
src/osd/modules/render/bgfx/chainentryreader.cpp
Normal file
48
src/osd/modules/render/bgfx/chainentryreader.cpp
Normal file
@ -0,0 +1,48 @@
|
||||
#include <string>
|
||||
|
||||
#include "emu.h"
|
||||
|
||||
#include "chainentryreader.h"
|
||||
|
||||
#include "texturemanager.h"
|
||||
#include "targetmanager.h"
|
||||
#include "effectmanager.h"
|
||||
#include "chainentry.h"
|
||||
#include "inputpair.h"
|
||||
|
||||
bgfx_chain_entry* chain_entry_reader::read_from_value(const Value& value, texture_manager& textures, target_manager& targets, effect_manager& effects)
|
||||
{
|
||||
validate_parameters(value);
|
||||
|
||||
bgfx_effect* effect = effects.effect(value["effect"].GetString());
|
||||
|
||||
std::vector<bgfx_input_pair> inputs;
|
||||
if (value.HasMember("input"))
|
||||
{
|
||||
const Value& input_array = value["input"];
|
||||
for (UINT32 i = 0; i < input_array.Size(); i++)
|
||||
{
|
||||
std::string sampler = input_array[i]["sampler"].GetString();
|
||||
std::string texture = input_array[i]["texture"].GetString();
|
||||
inputs.push_back(bgfx_input_pair(i, sampler, textures.texture(texture)));
|
||||
}
|
||||
}
|
||||
|
||||
bgfx_target* output = targets.target(value["output"].GetString());
|
||||
|
||||
return new bgfx_chain_entry(value["name"].GetString(), effect, inputs, output);
|
||||
}
|
||||
|
||||
void chain_entry_reader::validate_parameters(const Value& value)
|
||||
{
|
||||
assert(value.HasMember("effect"));
|
||||
assert(value["effect"].IsString());
|
||||
if (value.HasMember("name"))
|
||||
{
|
||||
assert(value["name"].IsString());
|
||||
}
|
||||
assert(value.HasMember("shader"));
|
||||
assert(value["shader"].IsString());
|
||||
assert(value.HasMember("output"));
|
||||
assert(value["output"].IsString());
|
||||
}
|
22
src/osd/modules/render/bgfx/chainentryreader.h
Normal file
22
src/osd/modules/render/bgfx/chainentryreader.h
Normal file
@ -0,0 +1,22 @@
|
||||
#pragma once
|
||||
|
||||
#ifndef __DRAWBGFX_CHAIN_ENTRY_READER__
|
||||
#define __DRAWBGFX_CHAIN_ENTRY_READER__
|
||||
|
||||
#include "statereader.h"
|
||||
|
||||
class bgfx_chain_entry;
|
||||
class texture_manager;
|
||||
class target_manager;
|
||||
class effect_manager;
|
||||
|
||||
class chain_entry_reader : public state_reader
|
||||
{
|
||||
public:
|
||||
static bgfx_chain_entry* read_from_value(const Value& value, texture_manager& textures, target_manager& targets, effect_manager& effects);
|
||||
|
||||
private:
|
||||
static void validate_parameters(const Value& value);
|
||||
};
|
||||
|
||||
#endif // __DRAWBGFX_CHAIN_ENTRY_READER__
|
15
src/osd/modules/render/bgfx/inputpair.cpp
Normal file
15
src/osd/modules/render/bgfx/inputpair.cpp
Normal file
@ -0,0 +1,15 @@
|
||||
#include "inputpair.h"
|
||||
#include "texture.h"
|
||||
#include "effect.h"
|
||||
|
||||
bgfx_input_pair::bgfx_input_pair(int index, std::string sampler, bgfx_texture* texture)
|
||||
: m_index(index)
|
||||
, m_sampler(sampler)
|
||||
, m_texture(texture)
|
||||
{
|
||||
}
|
||||
|
||||
void bgfx_input_pair::bind(bgfx_effect *effect)
|
||||
{
|
||||
bgfx::setTexture(m_index, effect->uniform(m_sampler)->handle(), m_texture->handle());
|
||||
}
|
26
src/osd/modules/render/bgfx/inputpair.h
Normal file
26
src/osd/modules/render/bgfx/inputpair.h
Normal file
@ -0,0 +1,26 @@
|
||||
#pragma once
|
||||
|
||||
#ifndef __DRAWBGFX_INPUT_PAIR__
|
||||
#define __DRAWBGFX_INPUT_PAIR__
|
||||
|
||||
#include <bgfx/bgfx.h>
|
||||
|
||||
#include <string>
|
||||
|
||||
class bgfx_effect;
|
||||
class bgfx_texture;
|
||||
|
||||
class bgfx_input_pair
|
||||
{
|
||||
public:
|
||||
bgfx_input_pair(int index, std::string sampler, bgfx_texture* texture);
|
||||
|
||||
void bind(bgfx_effect *effect);
|
||||
|
||||
private:
|
||||
int m_index;
|
||||
std::string m_sampler;
|
||||
bgfx_texture* m_texture;
|
||||
};
|
||||
|
||||
#endif // __DRAWBGFX_INPUT_PAIR__
|
@ -1,33 +0,0 @@
|
||||
#include "emu.h"
|
||||
|
||||
#include <bgfx/bgfx.h>
|
||||
|
||||
#include "effect.h"
|
||||
#include "texture.h"
|
||||
#include "target.h"
|
||||
#include "pass.h"
|
||||
|
||||
bgfx_pass::bgfx_pass(std::string name, bgfx_effect* effect, std::vector<bgfx_texture*>& inputs, bgfx_target* output)
|
||||
: m_name(name)
|
||||
, m_effect(effect)
|
||||
, m_output(output)
|
||||
{
|
||||
for (bgfx_texture* input : inputs)
|
||||
{
|
||||
m_inputs.push_back(input);
|
||||
}
|
||||
}
|
||||
|
||||
bgfx_pass::~bgfx_pass()
|
||||
{
|
||||
}
|
||||
|
||||
void bgfx_pass::submit(render_primitive* prim, int view)
|
||||
{
|
||||
for (int index = 0; index < m_inputs.size(); index++)
|
||||
{
|
||||
bgfx::setTexture(index, m_effect->uniform(m_inputs[index]->name())->handle(), m_inputs[index]->handle());
|
||||
}
|
||||
bgfx::setViewFrameBuffer(view, m_output->target());
|
||||
m_effect->submit(view);
|
||||
}
|
@ -1,32 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#ifndef __DRAWBGFX_PASS__
|
||||
#define __DRAWBGFX_PASS__
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
class render_primitive;
|
||||
class bgfx_effect;
|
||||
class bgfx_texture;
|
||||
class bgfx_target;
|
||||
|
||||
class bgfx_pass
|
||||
{
|
||||
public:
|
||||
bgfx_pass(std::string name, bgfx_effect* effect, std::vector<bgfx_texture*>& inputs, bgfx_target* output);
|
||||
~bgfx_pass();
|
||||
|
||||
void submit(render_primitive* prim, int view);
|
||||
|
||||
// Getters
|
||||
std::string name() const { return m_name; }
|
||||
|
||||
private:
|
||||
std::string m_name;
|
||||
bgfx_effect* m_effect;
|
||||
std::vector<bgfx_texture*> m_inputs;
|
||||
bgfx_target* m_output;
|
||||
};
|
||||
|
||||
#endif // __DRAWBGFX_PASS__
|
@ -1,49 +0,0 @@
|
||||
#include <string>
|
||||
|
||||
#include "emu.h"
|
||||
|
||||
#include "passreader.h"
|
||||
|
||||
#include "texturemanager.h"
|
||||
#include "targetmanager.h"
|
||||
#include "effectmanager.h"
|
||||
#include "pass.h"
|
||||
|
||||
bgfx_pass* pass_reader::read_from_value(const Value& value, texture_manager& textures, target_manager& targets, effect_manager& effects)
|
||||
{
|
||||
validate_parameters(value);
|
||||
|
||||
bgfx_effect* effect = effects.effect(value["effect"].GetString());
|
||||
|
||||
std::vector<bgfx_texture*> inputs;
|
||||
if (value.HasMember("input"))
|
||||
{
|
||||
const Value& input_array = value["input"];
|
||||
for (UINT32 i = 0; i < input_array.Size(); i++)
|
||||
{
|
||||
inputs.push_back(textures.texture(input_array[i].GetString()));
|
||||
}
|
||||
}
|
||||
|
||||
bgfx_target* output = targets.target(value["output"].GetString());
|
||||
|
||||
return new bgfx_pass(value["name"].GetString(), effect, inputs, output);
|
||||
}
|
||||
|
||||
void pass_reader::validate_parameters(const Value& value)
|
||||
{
|
||||
assert(value.HasMember("name"));
|
||||
assert(value["name"].IsString());
|
||||
assert(value.HasMember("output"));
|
||||
assert(value["output"].IsString());
|
||||
assert(value.HasMember("effect"));
|
||||
assert(value["effect"].IsString());
|
||||
if (value.HasMember("input"))
|
||||
{
|
||||
const Value& input_array = value["input"];
|
||||
for (int i = 0; i < input_array.Size(); i++)
|
||||
{
|
||||
assert(uniform_array[i].IsString());
|
||||
}
|
||||
}
|
||||
}
|
@ -1,22 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#ifndef __DRAWBGFX_PASS_READER__
|
||||
#define __DRAWBGFX_PASS_READER__
|
||||
|
||||
#include "statereader.h"
|
||||
|
||||
class bgfx_pass;
|
||||
class texture_manager;
|
||||
class target_manager;
|
||||
class effect_manager;
|
||||
|
||||
class pass_reader : public state_reader
|
||||
{
|
||||
public:
|
||||
static bgfx_pass* read_from_value(const Value& value, texture_manager& textures, target_manager& targets, effect_manager& effects);
|
||||
|
||||
private:
|
||||
static void validate_parameters(const Value& value);
|
||||
};
|
||||
|
||||
#endif // __DRAWBGFX_PASS_READER__
|
40
src/osd/modules/render/bgfx/slider.h
Normal file
40
src/osd/modules/render/bgfx/slider.h
Normal file
@ -0,0 +1,40 @@
|
||||
#pragma once
|
||||
|
||||
#ifndef __DRAWBGFX_SLIDER__
|
||||
#define __DRAWBGFX_SLIDER__
|
||||
|
||||
#include <bgfx/bgfx.h>
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <map>
|
||||
|
||||
#include "uniform.h"
|
||||
|
||||
class bgfx_slider
|
||||
{
|
||||
public:
|
||||
bgfx_slider(slider_type type, std::string name, std::string description, void *defaults, void *min, void *max);
|
||||
~bgfx_slider();
|
||||
|
||||
enum slider_type
|
||||
{
|
||||
SLIDER_BOOL,
|
||||
SLIDER_FLOAT,
|
||||
SLIDER_INT,
|
||||
SLIDER_COLOR,
|
||||
SLIDER_VEC2
|
||||
};
|
||||
|
||||
// Getters
|
||||
bgfx_uniform* uniform(std::string name);
|
||||
bgfx::ProgramHandle get_program() const { return m_program_handle; }
|
||||
|
||||
protected:
|
||||
std::string m_name;
|
||||
void * m_data;
|
||||
void * m_min;
|
||||
void * m_max;
|
||||
};
|
||||
|
||||
#endif // __DRAWBGFX_SLIDER__
|
20
src/osd/modules/render/bgfx/sliderreader.h
Normal file
20
src/osd/modules/render/bgfx/sliderreader.h
Normal file
@ -0,0 +1,20 @@
|
||||
#pragma once
|
||||
|
||||
#ifndef __DRAWBGFX_SLIDER_READER__
|
||||
#define __DRAWBGFX_SLIDER_READER__
|
||||
|
||||
#include "statereader.h"
|
||||
|
||||
class bgfx_slider;
|
||||
class shader_manager;
|
||||
|
||||
class slider_reader : public state_reader
|
||||
{
|
||||
public:
|
||||
static bgfx_slider* read_from_value(const Value& value);
|
||||
|
||||
private:
|
||||
static void validate_parameters(const Value& value);
|
||||
};
|
||||
|
||||
#endif // __DRAWBGFX_SLIDER_READER__
|
@ -3525,7 +3525,7 @@ ULONG effect::release()
|
||||
// get_slider_list
|
||||
//============================================================
|
||||
|
||||
slider_state *windows_osd_interface::get_slider_list()
|
||||
slider_state *renderer_d3d9::get_slider_list()
|
||||
{
|
||||
return g_slider_list;
|
||||
}
|
||||
|
@ -124,15 +124,24 @@ int renderer_bgfx::create()
|
||||
m_effects = new effect_manager(*m_shaders);
|
||||
|
||||
// Create program from shaders.
|
||||
printf("1\n"); fflush(stdout);
|
||||
m_gui_effect[0] = m_effects->effect("gui_opaque");
|
||||
printf("2\n"); fflush(stdout);
|
||||
m_gui_effect[1] = m_effects->effect("gui_blend");
|
||||
printf("3\n"); fflush(stdout);
|
||||
m_gui_effect[2] = m_effects->effect("gui_multiply");
|
||||
printf("4\n"); fflush(stdout);
|
||||
m_gui_effect[3] = m_effects->effect("gui_add");
|
||||
printf("5\n"); fflush(stdout);
|
||||
|
||||
m_screen_effect[0] = m_effects->effect("screen_opaque");
|
||||
printf("6\n"); fflush(stdout);
|
||||
m_screen_effect[1] = m_effects->effect("screen_blend");
|
||||
printf("7\n"); fflush(stdout);
|
||||
m_screen_effect[2] = m_effects->effect("screen_multiply");
|
||||
printf("8\n"); fflush(stdout);
|
||||
m_screen_effect[3] = m_effects->effect("screen_add");
|
||||
printf("9\n"); fflush(stdout);
|
||||
|
||||
uint32_t flags = BGFX_TEXTURE_U_CLAMP | BGFX_TEXTURE_V_CLAMP | BGFX_TEXTURE_MIN_POINT | BGFX_TEXTURE_MAG_POINT | BGFX_TEXTURE_MIP_POINT;
|
||||
m_texture_cache = m_textures->create_texture("#cache", bgfx::TextureFormat::RGBA8, CACHE_SIZE, CACHE_SIZE, nullptr, flags);
|
||||
@ -1078,3 +1087,8 @@ void renderer_bgfx::allocate_buffer(render_primitive *prim, UINT32 blend, bgfx::
|
||||
bgfx::allocTransientVertexBuffer(buffer, vertices, ScreenVertex::ms_decl);
|
||||
}
|
||||
}
|
||||
|
||||
slider_state* renderer_bgfx::get_slider_list()
|
||||
{
|
||||
return nullptr;
|
||||
}
|
@ -28,6 +28,7 @@ public:
|
||||
virtual ~renderer_bgfx();
|
||||
|
||||
virtual int create() override;
|
||||
virtual slider_state* get_slider_list() override;
|
||||
virtual int init(running_machine &machine) override { return 0; }
|
||||
virtual int draw(const int update) override;
|
||||
#ifdef OSD_SDL
|
||||
|
@ -42,6 +42,7 @@ public:
|
||||
virtual ~renderer_d3d9();
|
||||
|
||||
virtual int create() override;
|
||||
virtual slider_state* get_slider_list() override;
|
||||
virtual int init(running_machine &machine) override;
|
||||
virtual render_primitive_list *get_primitives() override;
|
||||
virtual int draw(const int update) override;
|
||||
|
@ -12,6 +12,7 @@
|
||||
|
||||
// MAME headers
|
||||
#include "emu.h"
|
||||
#include "ui/ui.h"
|
||||
#include "emuopts.h"
|
||||
#include "render.h"
|
||||
#include "uiinput.h"
|
||||
@ -66,8 +67,6 @@ static osd_window_config windows[MAX_WINDOWS]; // configuration data pe
|
||||
|
||||
bool windows_osd_interface::video_init()
|
||||
{
|
||||
int index;
|
||||
|
||||
// extract data from the options
|
||||
extract_video_config();
|
||||
|
||||
@ -79,14 +78,47 @@ bool windows_osd_interface::video_init()
|
||||
|
||||
// create the windows
|
||||
windows_options &options = downcast<windows_options &>(machine().options());
|
||||
for (index = 0; index < video_config.numscreens; index++)
|
||||
for (int index = 0; index < video_config.numscreens; index++)
|
||||
{
|
||||
win_window_info::create(machine(), index, osd_monitor_info::pick_monitor(options, index), &windows[index]);
|
||||
}
|
||||
|
||||
m_sliders = nullptr;
|
||||
slider_state *curr = m_sliders;
|
||||
for (win_window_info *info = win_window_list; info != nullptr; info = info->m_next)
|
||||
{
|
||||
slider_state *window_sliders = info->m_renderer->get_slider_list();
|
||||
if (window_sliders != nullptr)
|
||||
{
|
||||
if (m_sliders == nullptr)
|
||||
{
|
||||
m_sliders = curr = window_sliders;
|
||||
}
|
||||
else
|
||||
{
|
||||
while (curr->next != nullptr)
|
||||
{
|
||||
curr = curr->next;
|
||||
}
|
||||
curr->next = window_sliders;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (video_config.mode != VIDEO_MODE_NONE)
|
||||
SetForegroundWindow(win_window_list->m_hwnd);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
//============================================================
|
||||
// get_slider_list
|
||||
//============================================================
|
||||
|
||||
slider_state *windows_osd_interface::get_slider_list()
|
||||
{
|
||||
return m_sliders;
|
||||
}
|
||||
|
||||
//============================================================
|
||||
// video_exit
|
||||
|
@ -58,15 +58,15 @@ class dynamic_bind
|
||||
public:
|
||||
// constructor which looks up the function
|
||||
dynamic_bind(const TCHAR *dll, const char *symbol)
|
||||
: m_function(NULL)
|
||||
: m_function(nullptr)
|
||||
{
|
||||
HMODULE module = LoadLibrary(dll);
|
||||
if (module != NULL)
|
||||
if (module != nullptr)
|
||||
m_function = reinterpret_cast<_FunctionPtr>(GetProcAddress(module, symbol));
|
||||
}
|
||||
|
||||
// bool to test if the function is NULL or not
|
||||
operator bool() const { return (m_function != NULL); }
|
||||
// bool to test if the function is nullptr or not
|
||||
operator bool() const { return (m_function != nullptr); }
|
||||
|
||||
// dereference to get the underlying pointer
|
||||
_FunctionPtr operator *() const { return m_function; }
|
||||
@ -132,14 +132,14 @@ private:
|
||||
bool parse_sym_line(const char *line, FPTR &address, std::string &symbol);
|
||||
bool parse_map_line(const char *line, FPTR &address, std::string &symbol);
|
||||
void scan_cache_for_address(FPTR address);
|
||||
void format_symbol(const char *name, UINT32 displacement, const char *filename = NULL, int linenumber = 0);
|
||||
void format_symbol(const char *name, UINT32 displacement, const char *filename = nullptr, int linenumber = 0);
|
||||
|
||||
static FPTR get_text_section_base();
|
||||
|
||||
struct cache_entry
|
||||
{
|
||||
cache_entry(FPTR address, const char *symbol) :
|
||||
m_next(NULL), m_address(address), m_name(symbol) { }
|
||||
m_next(nullptr), m_address(address), m_name(symbol) { }
|
||||
cache_entry *next() const { return m_next; }
|
||||
|
||||
cache_entry * m_next;
|
||||
@ -206,11 +206,11 @@ public:
|
||||
char buffer[1024];
|
||||
|
||||
// if we are in fullscreen mode, go to windowed mode
|
||||
if ((video_config.windowed == 0) && (win_window_list != NULL))
|
||||
if ((video_config.windowed == 0) && (win_window_list != nullptr))
|
||||
winwindow_toggle_full_screen();
|
||||
|
||||
vsnprintf(buffer, ARRAY_LENGTH(buffer), msg, args);
|
||||
win_message_box_utf8(win_window_list ? win_window_list->m_hwnd : NULL, buffer, emulator_info::get_appname(), MB_OK);
|
||||
win_message_box_utf8(win_window_list ? win_window_list->m_hwnd : nullptr, buffer, emulator_info::get_appname(), MB_OK);
|
||||
}
|
||||
else
|
||||
chain_output(channel, msg, args);
|
||||
@ -242,8 +242,8 @@ static running_machine *g_current_machine;
|
||||
static int timeresult = !TIMERR_NOERROR;
|
||||
static TIMECAPS timecaps;
|
||||
|
||||
static sampling_profiler *profiler = NULL;
|
||||
static symbol_manager *symbols = NULL;
|
||||
static sampling_profiler *profiler = nullptr;
|
||||
static symbol_manager *symbols = nullptr;
|
||||
|
||||
bool stack_walker::s_initialized = false;
|
||||
|
||||
@ -267,25 +267,25 @@ static LONG WINAPI exception_filter(struct _EXCEPTION_POINTERS *info);
|
||||
const options_entry windows_options::s_option_entries[] =
|
||||
{
|
||||
// performance options
|
||||
{ NULL, NULL, OPTION_HEADER, "WINDOWS PERFORMANCE OPTIONS" },
|
||||
{ nullptr, nullptr, OPTION_HEADER, "WINDOWS PERFORMANCE OPTIONS" },
|
||||
{ WINOPTION_PRIORITY "(-15-1)", "0", OPTION_INTEGER, "thread priority for the main game thread; range from -15 to 1" },
|
||||
{ WINOPTION_PROFILE, "0", OPTION_INTEGER, "enables profiling, specifying the stack depth to track" },
|
||||
|
||||
// video options
|
||||
{ NULL, NULL, OPTION_HEADER, "WINDOWS VIDEO OPTIONS" },
|
||||
{ nullptr, nullptr, OPTION_HEADER, "WINDOWS VIDEO OPTIONS" },
|
||||
{ WINOPTION_MENU, "0", OPTION_BOOLEAN, "enables menu bar if available by UI implementation" },
|
||||
|
||||
// DirectDraw-specific options
|
||||
{ NULL, NULL, OPTION_HEADER, "DIRECTDRAW-SPECIFIC OPTIONS" },
|
||||
{ nullptr, nullptr, OPTION_HEADER, "DIRECTDRAW-SPECIFIC OPTIONS" },
|
||||
{ WINOPTION_HWSTRETCH ";hws", "1", OPTION_BOOLEAN, "enables hardware stretching" },
|
||||
|
||||
// post-processing options
|
||||
{ NULL, NULL, OPTION_HEADER, "DIRECT3D POST-PROCESSING OPTIONS" },
|
||||
{ WINOPTION_HLSL_ENABLE";hlsl", "0", OPTION_BOOLEAN, "enables HLSL post-processing (PS3.0 required)" },
|
||||
{ WINOPTION_HLSLPATH, "hlsl", OPTION_STRING, "path to hlsl files" },
|
||||
{ WINOPTION_HLSL_PRESCALE_X, "0", OPTION_INTEGER, "HLSL pre-scale override factor for X (0 for auto)" },
|
||||
{ WINOPTION_HLSL_PRESCALE_Y, "0", OPTION_INTEGER, "HLSL pre-scale override factor for Y (0 for auto)" },
|
||||
{ WINOPTION_HLSL_WRITE, NULL, OPTION_STRING, "enables HLSL AVI writing (huge disk bandwidth suggested)" },
|
||||
{ nullptr, nullptr, OPTION_HEADER, "DIRECT3D POST-PROCESSING OPTIONS" },
|
||||
{ WINOPTION_HLSL_ENABLE";hlsl", "0", OPTION_BOOLEAN, "enables HLSL post-processing (PS3.0 required)" },
|
||||
{ WINOPTION_HLSLPATH, "hlsl", OPTION_STRING, "path to hlsl files" },
|
||||
{ WINOPTION_HLSL_PRESCALE_X, "0", OPTION_INTEGER, "HLSL pre-scale override factor for X (0 for auto)" },
|
||||
{ WINOPTION_HLSL_PRESCALE_Y, "0", OPTION_INTEGER, "HLSL pre-scale override factor for Y (0 for auto)" },
|
||||
{ WINOPTION_HLSL_WRITE, nullptr, OPTION_STRING, "enables HLSL AVI writing (huge disk bandwidth suggested)" },
|
||||
{ WINOPTION_HLSL_SNAP_WIDTH, "2048", OPTION_STRING, "HLSL upscaled-snapshot width" },
|
||||
{ WINOPTION_HLSL_SNAP_HEIGHT, "1536", OPTION_STRING, "HLSL upscaled-snapshot height" },
|
||||
{ WINOPTION_SHADOW_MASK_TILE_MODE, "0", OPTION_INTEGER, "shadow mask tile mode (0 for screen based, 1 for source based)" },
|
||||
@ -326,7 +326,7 @@ const options_entry windows_options::s_option_entries[] =
|
||||
{ WINOPTION_FLOOR";fs_floor", "0.05,0.05,0.05", OPTION_STRING, "signal floor level" },
|
||||
{ WINOPTION_PHOSPHOR";fs_phosphor", "0.4,0.4,0.4", OPTION_STRING, "phosphorescence decay rate (0.0 is instant, 1.0 is forever)" },
|
||||
/* NTSC simulation below this line */
|
||||
{ NULL, NULL, OPTION_HEADER, "NTSC POST-PROCESSING OPTIONS" },
|
||||
{ nullptr, nullptr, OPTION_HEADER, "NTSC POST-PROCESSING OPTIONS" },
|
||||
{ WINOPTION_YIQ_ENABLE";yiq", "0", OPTION_BOOLEAN, "enables YIQ-space HLSL post-processing" },
|
||||
{ WINOPTION_YIQ_JITTER";yiqj", "0.0", OPTION_FLOAT, "Jitter for the NTSC signal processing" },
|
||||
{ WINOPTION_YIQ_CCVALUE";yiqcc", "3.57954545", OPTION_FLOAT, "Color Carrier frequency for NTSC signal processing" },
|
||||
@ -341,11 +341,11 @@ const options_entry windows_options::s_option_entries[] =
|
||||
{ WINOPTION_YIQ_SCAN_TIME";yiqsc", "52.6", OPTION_FLOAT, "Horizontal scanline duration for NTSC signal processing (in usec)" },
|
||||
{ WINOPTION_YIQ_PHASE_COUNT";yiqp", "2", OPTION_INTEGER, "Phase Count value for NTSC signal processing" },
|
||||
/* Vector simulation below this line */
|
||||
{ NULL, NULL, OPTION_HEADER, "VECTOR POST-PROCESSING OPTIONS" },
|
||||
{ nullptr, nullptr, OPTION_HEADER, "VECTOR POST-PROCESSING OPTIONS" },
|
||||
{ WINOPTION_VECTOR_LENGTH_SCALE";veclength", "0.5", OPTION_FLOAT, "How much length affects vector fade" },
|
||||
{ WINOPTION_VECTOR_LENGTH_RATIO";vecsize", "500.0", OPTION_FLOAT, "Vector fade length (4.0 - vectors fade the most at and above 4 pixels, etc.)" },
|
||||
/* Bloom below this line */
|
||||
{ NULL, NULL, OPTION_HEADER, "BLOOM POST-PROCESSING OPTIONS" },
|
||||
{ nullptr, nullptr, OPTION_HEADER, "BLOOM POST-PROCESSING OPTIONS" },
|
||||
{ WINOPTION_BLOOM_BLEND_MODE, "0", OPTION_INTEGER, "bloom blend mode (0 for addition, 1 for darken)" },
|
||||
{ WINOPTION_BLOOM_SCALE, "0.25", OPTION_FLOAT, "Intensity factor for bloom" },
|
||||
{ WINOPTION_BLOOM_OVERDRIVE, "1.0,1.0,1.0", OPTION_STRING, "Overdrive factor for bloom" },
|
||||
@ -362,18 +362,18 @@ const options_entry windows_options::s_option_entries[] =
|
||||
{ WINOPTION_BLOOM_LEVEL10_WEIGHT, "0.01", OPTION_FLOAT, "Bloom level 10 (1x1 target) weight" },
|
||||
|
||||
// full screen options
|
||||
{ NULL, NULL, OPTION_HEADER, "FULL SCREEN OPTIONS" },
|
||||
{ nullptr, nullptr, OPTION_HEADER, "FULL SCREEN OPTIONS" },
|
||||
{ WINOPTION_TRIPLEBUFFER ";tb", "0", OPTION_BOOLEAN, "enables triple buffering" },
|
||||
{ WINOPTION_FULLSCREENBRIGHTNESS ";fsb(0.1-2.0)", "1.0", OPTION_FLOAT, "brightness value in full screen mode" },
|
||||
{ WINOPTION_FULLSCREENCONTRAST ";fsc(0.1-2.0)", "1.0", OPTION_FLOAT, "contrast value in full screen mode" },
|
||||
{ WINOPTION_FULLSCREENGAMMA ";fsg(0.1-3.0)", "1.0", OPTION_FLOAT, "gamma value in full screen mode" },
|
||||
|
||||
// input options
|
||||
{ NULL, NULL, OPTION_HEADER, "INPUT DEVICE OPTIONS" },
|
||||
{ nullptr, nullptr, OPTION_HEADER, "INPUT DEVICE OPTIONS" },
|
||||
{ WINOPTION_GLOBAL_INPUTS ";global_inputs", "0", OPTION_BOOLEAN, "enables global inputs" },
|
||||
{ WINOPTION_DUAL_LIGHTGUN ";dual", "0", OPTION_BOOLEAN, "enables dual lightgun input" },
|
||||
|
||||
{ NULL }
|
||||
{ nullptr }
|
||||
};
|
||||
|
||||
//**************************************************************************
|
||||
@ -389,9 +389,9 @@ int main(int argc, char *argv[])
|
||||
{
|
||||
// use small output buffers on non-TTYs (i.e. pipes)
|
||||
if (!isatty(fileno(stdout)))
|
||||
setvbuf(stdout, (char *) NULL, _IOFBF, 64);
|
||||
setvbuf(stdout, (char *) nullptr, _IOFBF, 64);
|
||||
if (!isatty(fileno(stderr)))
|
||||
setvbuf(stderr, (char *) NULL, _IOFBF, 64);
|
||||
setvbuf(stderr, (char *) nullptr, _IOFBF, 64);
|
||||
|
||||
// initialize common controls
|
||||
InitCommonControls();
|
||||
@ -434,7 +434,7 @@ int main(int argc, char *argv[])
|
||||
osd_output::pop(&winerror);
|
||||
}
|
||||
// free symbols
|
||||
symbols = NULL;
|
||||
symbols = nullptr;
|
||||
return result;
|
||||
}
|
||||
|
||||
@ -469,7 +469,7 @@ static BOOL WINAPI control_handler(DWORD type)
|
||||
|
||||
// if we don't have a machine yet, or if we are handling ctrl+c/ctrl+break,
|
||||
// just terminate hard, without throwing or handling any atexit stuff
|
||||
if (g_current_machine == NULL || type == CTRL_C_EVENT || type == CTRL_BREAK_EVENT)
|
||||
if (g_current_machine == nullptr || type == CTRL_C_EVENT || type == CTRL_BREAK_EVENT)
|
||||
{
|
||||
fprintf(stderr, ", exiting\n");
|
||||
TerminateProcess(GetCurrentProcess(), MAMERR_FATALERROR);
|
||||
@ -505,7 +505,9 @@ static void output_oslog(const running_machine &machine, const char *buffer)
|
||||
//============================================================
|
||||
|
||||
windows_osd_interface::windows_osd_interface(windows_options &options)
|
||||
: osd_common_t(options), m_options(options)
|
||||
: osd_common_t(options)
|
||||
, m_options(options)
|
||||
, m_sliders(nullptr)
|
||||
{
|
||||
}
|
||||
|
||||
@ -525,10 +527,10 @@ windows_osd_interface::~windows_osd_interface()
|
||||
|
||||
void windows_osd_interface::video_register()
|
||||
{
|
||||
video_options_add("gdi", NULL);
|
||||
video_options_add("d3d", NULL);
|
||||
video_options_add("bgfx", NULL);
|
||||
//video_options_add("auto", NULL); // making d3d video default one
|
||||
video_options_add("gdi", nullptr);
|
||||
video_options_add("d3d", nullptr);
|
||||
video_options_add("bgfx", nullptr);
|
||||
//video_options_add("auto", nullptr); // making d3d video default one
|
||||
}
|
||||
|
||||
//============================================================
|
||||
@ -589,7 +591,7 @@ void windows_osd_interface::init(running_machine &machine)
|
||||
|
||||
// notify listeners of screen configuration
|
||||
std::string tempstring;
|
||||
for (win_window_info *info = win_window_list; info != NULL; info = info->m_next)
|
||||
for (win_window_info *info = win_window_list; info != nullptr; info = info->m_next)
|
||||
{
|
||||
strprintf(tempstring, "Orientation(%s)", info->m_monitor->devicename());
|
||||
machine.output().set_value(tempstring.c_str(), info->m_targetorient);
|
||||
@ -609,12 +611,12 @@ void windows_osd_interface::init(running_machine &machine)
|
||||
int watchdog = options.watchdog();
|
||||
if (watchdog != 0)
|
||||
{
|
||||
watchdog_reset_event = CreateEvent(NULL, FALSE, FALSE, NULL);
|
||||
assert_always(watchdog_reset_event != NULL, "Failed to create watchdog reset event");
|
||||
watchdog_exit_event = CreateEvent(NULL, TRUE, FALSE, NULL);
|
||||
assert_always(watchdog_exit_event != NULL, "Failed to create watchdog exit event");
|
||||
watchdog_thread = CreateThread(NULL, 0, watchdog_thread_entry, (LPVOID)(FPTR)watchdog, 0, NULL);
|
||||
assert_always(watchdog_thread != NULL, "Failed to create watchdog thread");
|
||||
watchdog_reset_event = CreateEvent(nullptr, FALSE, FALSE, nullptr);
|
||||
assert_always(watchdog_reset_event != nullptr, "Failed to create watchdog reset event");
|
||||
watchdog_exit_event = CreateEvent(nullptr, TRUE, FALSE, nullptr);
|
||||
assert_always(watchdog_exit_event != nullptr, "Failed to create watchdog exit event");
|
||||
watchdog_thread = CreateThread(nullptr, 0, watchdog_thread_entry, (LPVOID)(FPTR)watchdog, 0, nullptr);
|
||||
assert_always(watchdog_thread != nullptr, "Failed to create watchdog thread");
|
||||
}
|
||||
|
||||
// create and start the profiler
|
||||
@ -639,7 +641,7 @@ void windows_osd_interface::init(running_machine &machine)
|
||||
void windows_osd_interface::osd_exit()
|
||||
{
|
||||
// no longer have a machine
|
||||
g_current_machine = NULL;
|
||||
g_current_machine = nullptr;
|
||||
|
||||
// cleanup sockets
|
||||
win_cleanup_sockets();
|
||||
@ -647,20 +649,20 @@ void windows_osd_interface::osd_exit()
|
||||
osd_common_t::osd_exit();
|
||||
|
||||
// take down the watchdog thread if it exists
|
||||
if (watchdog_thread != NULL)
|
||||
if (watchdog_thread != nullptr)
|
||||
{
|
||||
SetEvent(watchdog_exit_event);
|
||||
WaitForSingleObject(watchdog_thread, INFINITE);
|
||||
CloseHandle(watchdog_reset_event);
|
||||
CloseHandle(watchdog_exit_event);
|
||||
CloseHandle(watchdog_thread);
|
||||
watchdog_reset_event = NULL;
|
||||
watchdog_exit_event = NULL;
|
||||
watchdog_thread = NULL;
|
||||
watchdog_reset_event = nullptr;
|
||||
watchdog_exit_event = nullptr;
|
||||
watchdog_thread = nullptr;
|
||||
}
|
||||
|
||||
// stop the profiler
|
||||
if (profiler != NULL)
|
||||
if (profiler != nullptr)
|
||||
{
|
||||
profiler->stop();
|
||||
profiler->print_results(*symbols);
|
||||
@ -688,7 +690,7 @@ void winmain_dump_stack()
|
||||
|
||||
// walk the stack
|
||||
while (walker.unwind())
|
||||
fprintf(stderr, " %p: %p%s\n", (void *)walker.frame(), (void *)walker.ip(), (symbols == NULL) ? "" : symbols->symbol_for_address(walker.ip()));
|
||||
fprintf(stderr, " %p: %p%s\n", (void *)walker.frame(), (void *)walker.ip(), (symbols == nullptr) ? "" : symbols->symbol_for_address(walker.ip()));
|
||||
}
|
||||
|
||||
|
||||
@ -753,7 +755,7 @@ static DWORD WINAPI watchdog_thread_entry(LPVOID lpParameter)
|
||||
void winmain_watchdog_ping(void)
|
||||
{
|
||||
// if we have a watchdog, reset it
|
||||
if (watchdog_reset_event != NULL)
|
||||
if (watchdog_reset_event != nullptr)
|
||||
SetEvent(watchdog_reset_event);
|
||||
}
|
||||
|
||||
@ -866,7 +868,7 @@ static LONG WINAPI exception_filter(struct _EXCEPTION_POINTERS *info)
|
||||
|
||||
// walk the stack
|
||||
while (walker.unwind())
|
||||
fprintf(stderr, " %p: %p%s\n", (void *)walker.frame(), (void *)walker.ip(), (symbols == NULL) ? "" : symbols->symbol_for_address(walker.ip()));
|
||||
fprintf(stderr, " %p: %p%s\n", (void *)walker.frame(), (void *)walker.ip(), (symbols == nullptr) ? "" : symbols->symbol_for_address(walker.ip()));
|
||||
|
||||
// flush stderr, so the data is actually written when output is being redirected
|
||||
fflush(stderr);
|
||||
@ -901,7 +903,7 @@ stack_walker::stack_walker()
|
||||
// initialize the symbols
|
||||
if (!s_initialized && m_sym_initialize && m_stack_walk_64 && m_sym_function_table_access_64 && m_sym_get_module_base_64)
|
||||
{
|
||||
(*m_sym_initialize)(m_process, NULL, TRUE);
|
||||
(*m_sym_initialize)(m_process, nullptr, TRUE);
|
||||
s_initialized = true;
|
||||
}
|
||||
}
|
||||
@ -975,9 +977,9 @@ bool stack_walker::unwind()
|
||||
if (s_initialized)
|
||||
{
|
||||
#ifdef PTR64
|
||||
return (*m_stack_walk_64)(IMAGE_FILE_MACHINE_AMD64, m_process, m_thread, &m_stackframe, &m_context, NULL, *m_sym_function_table_access_64, *m_sym_get_module_base_64, NULL);
|
||||
return (*m_stack_walk_64)(IMAGE_FILE_MACHINE_AMD64, m_process, m_thread, &m_stackframe, &m_context, nullptr, *m_sym_function_table_access_64, *m_sym_get_module_base_64, nullptr);
|
||||
#else
|
||||
return (*m_stack_walk_64)(IMAGE_FILE_MACHINE_I386, m_process, m_thread, &m_stackframe, &m_context, NULL, *m_sym_function_table_access_64, *m_sym_get_module_base_64, NULL);
|
||||
return (*m_stack_walk_64)(IMAGE_FILE_MACHINE_I386, m_process, m_thread, &m_stackframe, &m_context, nullptr, *m_sym_function_table_access_64, *m_sym_get_module_base_64, nullptr);
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -1056,7 +1058,7 @@ const char *symbol_manager::symbol_for_address(FPTR address)
|
||||
if (!query_system_for_address(address))
|
||||
{
|
||||
// if that fails, scan the cache if we have one
|
||||
if (m_cache.first() != NULL)
|
||||
if (m_cache.first() != nullptr)
|
||||
scan_cache_for_address(address);
|
||||
|
||||
// or else try to open a sym/map file and find it there
|
||||
@ -1113,20 +1115,20 @@ bool symbol_manager::query_system_for_address(FPTR address)
|
||||
void symbol_manager::scan_file_for_address(FPTR address, bool create_cache)
|
||||
{
|
||||
bool is_symfile = false;
|
||||
FILE *srcfile = NULL;
|
||||
FILE *srcfile = nullptr;
|
||||
|
||||
#ifdef __GNUC__
|
||||
// see if we have a symbol file (gcc only)
|
||||
srcfile = fopen(m_symfile.c_str(), "r");
|
||||
is_symfile = (srcfile != NULL);
|
||||
is_symfile = (srcfile != nullptr);
|
||||
#endif
|
||||
|
||||
// if not, see if we have a map file
|
||||
if (srcfile == NULL)
|
||||
if (srcfile == nullptr)
|
||||
srcfile = fopen(m_mapfile.c_str(), "r");
|
||||
|
||||
// if not, fail
|
||||
if (srcfile == NULL)
|
||||
if (srcfile == nullptr)
|
||||
return;
|
||||
|
||||
// reset the best info
|
||||
@ -1179,7 +1181,7 @@ void symbol_manager::scan_cache_for_address(FPTR address)
|
||||
FPTR best_addr = 0;
|
||||
|
||||
// walk the cache, looking for valid entries
|
||||
for (cache_entry *entry = m_cache.first(); entry != NULL; entry = entry->next())
|
||||
for (cache_entry *entry = m_cache.first(); entry != nullptr; entry = entry->next())
|
||||
|
||||
// if this is the best one so far, remember it
|
||||
if (entry->m_address <= address && entry->m_address > best_addr)
|
||||
@ -1212,7 +1214,7 @@ bool symbol_manager::parse_sym_line(const char *line, FPTR &address, std::string
|
||||
|
||||
// first look for a (ty) entry
|
||||
const char *type = strstr(line, "(ty 20)");
|
||||
if (type == NULL)
|
||||
if (type == nullptr)
|
||||
return false;
|
||||
|
||||
// scan forward in the line to find the address
|
||||
@ -1299,7 +1301,7 @@ void symbol_manager::format_symbol(const char *name, UINT32 displacement, const
|
||||
strcatprintf(m_buffer, "+0x%04x", (UINT32)displacement);
|
||||
|
||||
// append file/line if present
|
||||
if (filename != NULL)
|
||||
if (filename != nullptr)
|
||||
strcatprintf(m_buffer, ", %s:%d", filename, linenumber);
|
||||
|
||||
// close up the string
|
||||
@ -1319,18 +1321,18 @@ FPTR symbol_manager::get_text_section_base()
|
||||
|
||||
// start with the image base
|
||||
PVOID base = reinterpret_cast<PVOID>(GetModuleHandleUni());
|
||||
assert(base != NULL);
|
||||
assert(base != nullptr);
|
||||
|
||||
// make sure we have the functions we need
|
||||
if (image_nt_header && image_rva_to_section)
|
||||
{
|
||||
// get the NT header
|
||||
PIMAGE_NT_HEADERS headers = (*image_nt_header)(base);
|
||||
assert(headers != NULL);
|
||||
assert(headers != nullptr);
|
||||
|
||||
// look ourself up (assuming we are in the .text section)
|
||||
PIMAGE_SECTION_HEADER section = (*image_rva_to_section)(headers, base, reinterpret_cast<FPTR>(get_text_section_base) - reinterpret_cast<FPTR>(base));
|
||||
if (section != NULL)
|
||||
if (section != nullptr)
|
||||
return reinterpret_cast<FPTR>(base) + section->VirtualAddress;
|
||||
}
|
||||
|
||||
@ -1349,8 +1351,8 @@ FPTR symbol_manager::get_text_section_base()
|
||||
//-------------------------------------------------
|
||||
|
||||
sampling_profiler::sampling_profiler(UINT32 max_seconds, UINT8 stack_depth = 0)
|
||||
: m_target_thread(NULL),
|
||||
m_thread(NULL),
|
||||
: m_target_thread(nullptr),
|
||||
m_thread(nullptr),
|
||||
m_thread_id(0),
|
||||
m_thread_exit(false),
|
||||
m_stack_depth(stack_depth),
|
||||
@ -1386,8 +1388,8 @@ void sampling_profiler::start()
|
||||
m_thread_exit = false;
|
||||
|
||||
// start the thread
|
||||
m_thread = CreateThread(NULL, 0, thread_entry, (LPVOID)this, 0, &m_thread_id);
|
||||
assert_always(m_thread != NULL, "Failed to create profiler thread\n");
|
||||
m_thread = CreateThread(nullptr, 0, thread_entry, (LPVOID)this, 0, &m_thread_id);
|
||||
assert_always(m_thread != nullptr, "Failed to create profiler thread\n");
|
||||
|
||||
// max out the priority
|
||||
SetThreadPriority(m_thread, THREAD_PRIORITY_TIME_CRITICAL);
|
||||
@ -1555,7 +1557,7 @@ void sampling_profiler::thread_run()
|
||||
*count += 1;
|
||||
}
|
||||
|
||||
// fill in any missing parts with NULLs
|
||||
// fill in any missing parts with nulls
|
||||
for (; frame <= m_stack_depth; frame++)
|
||||
*m_buffer_ptr++ = 0;
|
||||
|
||||
|
@ -276,6 +276,7 @@ public:
|
||||
private:
|
||||
virtual void osd_exit() override;
|
||||
windows_options &m_options;
|
||||
slider_state *m_sliders;
|
||||
|
||||
static const int DEFAULT_FONT_HEIGHT = 200;
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user