Skip to content

Commit

Permalink
Debug option
Browse files Browse the repository at this point in the history
  • Loading branch information
univrsal committed Sep 2, 2018
1 parent 7ec4631 commit feecf79
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 23 deletions.
4 changes: 2 additions & 2 deletions sources/input-history.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -481,7 +481,7 @@ bool mode_changed(obs_properties_t * props, obs_property_t * p, obs_data_t * s)

obs_properties_t * get_properties_for_history(void * data)
{
InputHistorySource *s = reinterpret_cast<InputHistorySource*>(data);
auto *s = reinterpret_cast<InputHistorySource*>(data);

obs_properties_t * props = obs_properties_create();

Expand All @@ -490,7 +490,7 @@ obs_properties_t * get_properties_for_history(void * data)
obs_property_list_add_int(mode_list, T_OVERLAY_MODE_TEXT, 0);
obs_property_list_add_int(mode_list, T_OVERLAY_MODE_ICON, 1);
obs_property_set_modified_callback(mode_list, mode_changed);

blog(LOG_INFO, "ADDED HISTORY MODE LIST");
// Key name file
std::string filter_img = util_file_filter(T_FILTER_IMAGE_FILES, "*.jpg *.png *.bmp");
std::string filter_text = util_file_filter(T_FILTER_TEXT_FILES, "*.ini");
Expand Down
2 changes: 1 addition & 1 deletion sources/input-history.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -161,4 +161,4 @@ static obs_properties_t *get_properties_for_history(void *data);

void register_history();

#endif
#endif
30 changes: 17 additions & 13 deletions sources/input-source.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -384,6 +384,7 @@ void InputSource::load_layout()
}
else if (m_layout.m_type == TYPE_CONTROLLER)
{

m_layout.m_w = (uint16_t) cfg->get_int("pad_w");
m_layout.m_h = (uint16_t) cfg->get_int("pad_h");
m_layout.m_track_radius = (uint16_t) cfg->get_int("pad_analog_radius");
Expand Down Expand Up @@ -510,9 +511,9 @@ void InputSource::load_layout()
keys[PAD_DPAD_RIGHT].column = (uint16_t) cfg->get_int("pad_dpad_right_x");
keys[PAD_DPAD_RIGHT].row = (uint16_t) cfg->get_int("pad_dpad_right_y");

for (int i = 0; i < PAD_ICON_COUNT; i++)
for (auto & key : keys)
{
m_layout.m_keys.emplace_back(keys[i]);
m_layout.m_keys.emplace_back(key);
}
}

Expand All @@ -535,19 +536,22 @@ void InputSource::load_layout()
m_layout.m_is_loaded = false;
}
}

blog(LOG_INFO, "------ input-overlay DEBUG");
for (int i = 0; i < m_layout.m_key_count; i++)
if (cfg->get_bool("debug"))
{
blog(LOG_INFO, "KEY ID: %02d, CODE: %#04X, X: %05d, Y: %05d, U: %05d, V: %05d, W: %05d, H: %05d, X_OFF: %05d",
i, m_layout.m_keys[i].m_key_code,
m_layout.m_keys[i].column, m_layout.m_keys[i].row,
m_layout.m_keys[i].texture_u, m_layout.m_keys[i].texture_v,
m_layout.m_keys[i].w, m_layout.m_keys[i].h,
m_layout.m_keys[i].x_offset);
blog(LOG_INFO, "------ input-overlay DEBUG");
cfg->dump_structure();
for (int i = 0; i < m_layout.m_key_count; i++)
{
blog(LOG_INFO, "KEY ID: %02d, CODE: %#04X, X: %05d, Y: %05d, U: %05d, V: %05d, W: %05d, H: %05d, X_OFF: %05d",
i, m_layout.m_keys[i].m_key_code,
m_layout.m_keys[i].column, m_layout.m_keys[i].row,
m_layout.m_keys[i].texture_u, m_layout.m_keys[i].texture_v,
m_layout.m_keys[i].w, m_layout.m_keys[i].h,
m_layout.m_keys[i].x_offset);
}
blog(LOG_INFO, "------");
}
blog(LOG_INFO, "------");


delete cfg;
}

Expand Down
12 changes: 6 additions & 6 deletions util/layout.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,19 @@
*/

struct InputKey {
uint16_t m_key_code;
uint16_t m_key_code = 0x0;
bool m_pressed = false;
uint16_t texture_u, texture_v;
uint16_t w, h;
uint16_t texture_u = 0x0, texture_v = 0x0;
uint16_t w = 0x0, h = 0x0;

uint16_t x_offset; // used to center buttons that span over multiple columns
uint16_t row, column; // On screen location (in pixels for mouse/controller layouts)
uint16_t x_offset = 0x0; // used to center buttons that span over multiple columns
uint16_t row = 0x0, column = 0x0; // On screen location (in pixels for mouse/controller layouts)
};

struct OverlayLayout {
LayoutType m_type;
uint8_t m_key_count;
uint16_t m_key_space_v, m_key_space_h;
int16_t m_key_space_v, m_key_space_h;
uint16_t m_btn_w, m_btn_h;
uint16_t m_w, m_h;
uint16_t m_rows, m_cols;
Expand Down
2 changes: 1 addition & 1 deletion util/util.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -226,4 +226,4 @@ uint16_t random_vc(void);
#define VC_KP_LEFT 0xEE4D
#define VC_KP_RIGHT 0xEE50
#endif
#endif
#endif

0 comments on commit feecf79

Please sign in to comment.